0

I have application with Activity, where onSaveInstanceState():

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putBoolean("XXX", true);
    super.onSaveInstanceState(outState);
}

Then I'm doing the steps:

  1. Start my application.
  2. Press device 'Home' button (going to Android main screen).
  3. Go to list of applications and press my app icon.
  4. My application is shown again.

I expect, that after restarting savedInstanceState in onCreate() will contain boolean "XXX". But savedInstanceState is null. Why it is null?

I have tried set activity's launchMode attribute to any value ('standard', 'singleTask', 'singleTop, 'singleInstance') - it doesn't affect.

Alexey
  • 2,310
  • 2
  • 24
  • 42
  • 1
    Possible duplicate of [savedInstanceState is always null](http://stackoverflow.com/questions/6554317/savedinstancestate-is-always-null) – Michael Dodd Mar 07 '17 at 16:33
  • pressing the home button will not cause your app to be terminated and thus `onCreate` won't be called again. – Droidman Mar 07 '17 at 17:06

0 Answers0