How can I prevent the ActionBar back button (we gonna say ABBB) of my SecondActivity
to recreate the MainActivity
when clicked ?
I have a ListView
in the MainActivity
and it can be edited using the SecondActivity
. The problem is that when the user presses the ABBB, the ListView
is reset to default...
However, when the user clicks my OK button or presses physical back button, there is not any problem because I'm using finish();
@Override
public void onBackPressed() {
finish();
}
If I use this code... :
switch (item.getItemId()) {
case (android.R.id.home):
finish();
}
...there is the same problem because, I guess, this method is called after "Android's code".
How can I totally override Android ABBB's clicked code to set it to just call finish();
?