活动onCreate()savedInstanceState为null

时间:2017-03-07 16:11:06

标签: android android-activity

我有活动的应用程序,其中onSaveInstanceState()

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

然后我正在做的步骤:

  1. 启动我的申请。
  2. 按设备“主页”按钮(转到Android主屏幕)。
  3. 转到应用程序列表,然后按我的应用程序图标。
  4. 我的申请再次显示。
  5. 我希望,在savedInstanceState中重新启动onCreate()后,将包含布尔值“XXX”。但savedInstanceState为空。 为何为空?

    我已经尝试将set activity的launchMode属性设置为任何值('standard','singleTask','singleTop,'singleInstance') - 它不会影响。

0 个答案:

没有答案
相关问题