There is a main activity and the menu from which 3 more activities are called. In all 4 activities there is a code:
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_about) { Intent intent = new Intent(this, AboutActivity.class); startActivity(intent); } if (id == R.id.action_add) { Intent intent = new Intent(this, ActivityAdd.class); startActivity(intent); } if (id == R.id.action_edit) { Intent intent = new Intent(this, ActivityEdit.class); startActivity(intent); } return super.onOptionsItemSelected(item); }
finish();after each callstartActivity();- pavlofff