Now there is a strange question, I have two Activity, A and B, the first to jump from A to B, B to input some properties, after completion, B return A, and call B.finish() method, but the problem is that when B finish, A method automatically calls the onDestroy and re onCreate, how is this going?

This phenomenon occurs in the use of tablet PCs, and will not appear on the use of mobile phones. PAD memory large enough. And set android:screenOrientation="portrait"

A and B Activity use same baseActivity with different viewGroup. so can't use android:launchMode="singleTop"

After B also tried to open C Activity, and then finish C, then B is normal onResume, did not execute onDestroy, why only in B returns A onDestroy A will lead it?

Life cycle is as follows:

A onCreate
A onStart
A onResume
------------------
A onPause
B onCreate
B onStart
B onResume
A onStop
-------------------call B.finish()
B onPause
A onDestroy
A onCreate
A onStart
A onResume
B onStop
B onDestroy

A onDestroy should not appear ah.

有帮助吗?

解决方案

Please take a look at the diagram in the following link. http://developer.android.com/reference/android/app/Activity.html when you you call on finish() it will call on destroy after that call since you are done with the activity .

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top