Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onSaveInstanceState #48

Open
ghost opened this issue Jan 23, 2017 · 1 comment
Open

onSaveInstanceState #48

ghost opened this issue Jan 23, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 23, 2017

有a、b两个Activity,当从a进入b之后一段时间,可能系统会把a回收,这时候按back,执行的不是a的onRestart而是onCreate方法,a被重新创建一次,这是a中的临时数据和状态可能就丢失了。绝对不走Oncreate方法、lz还是考虑考虑边实践边写文章吧

@linq8261
Copy link

你是说绝对不走 onSaveInstanceState 方法吧,在a进入b之前就已经执行了 onSaveInstanceState 方法了,你自己实践一下再说。

com.audienl.test I/AudienL: LifeCycle : MainActivity -> onPause
com.audienl.test I/AudienL: LifeCycle : SecondActivity -> onCreate : savedInstanceState = null
com.audienl.test I/AudienL: LifeCycle : SecondActivity -> onStart
com.audienl.test I/AudienL: LifeCycle : SecondActivity -> onResume
com.audienl.test I/AudienL: LifeCycle : MainActivity -> onSaveInstanceState
com.audienl.test I/AudienL: LifeCycle : MainActivity -> onStop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant