Activity A ===click button===> Activity B
When press back button, Activity A is not recreated.
When press home as up button, Activity A is recreated.
So I save state when A.onSaveInstanceState(Bundle outState) , and use state when A.onRestoreInstanceState(Bundle savedInstanceState).
Saving and Using works fine (except home as up button)
.
However,
When pressed home as up button, system recreate Activity A, and savedInstanceState is gone.
How can I use Saved Instance State?
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// I do not want this...
// Home as up button is to navigate to Home-Activity not previous acitivity
super.onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}