Android activity recreate itself

后端 未结 13 1540
攒了一身酷
攒了一身酷 2021-02-05 07:06

My app normally works just fine, until I face a strange problem on specific device. There are 2 activities in App. After I start ActivityB inside of ActivityA, ActivityA starts

13条回答
  •  你的背包
    2021-02-05 07:43

    I do not see any problem in this behaviour.

    In case you wish to preserve the state of ActivityA, make use of the methods onSaveInstanceState and onRestoreInstanceState. See Activity Lifecycle at http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle for more details.

    See also https://stackoverflow.com/a/10492967/332210 for a deeper understanding.

提交回复
热议问题