LoginActivity
to Log in with Smart Lock . I start the LoginActivity
as startActivityForResult
. I'm interested in if Smart Lock has a credential, and return RESULT_OK
if everything is ok. Then I call finish()
:
loginActivityViewPresenter.setResult(RESULT_OK) loginActivityViewPresenter.finish()
After this, onDestroy()
is called. Let's imagine this is the instance @7161
.
Then I log out, and I want to log in again, and the same instance is on the top @7161
.
Functions like isDestroyed()
or isFinishing()
are always true.
Why?
It looks like the AsyncTasks you are using or some other object are keeping are a reference to your activity and the android framework is using that existing activity when you start it again.
You can determine this by doing a heap dump after finishing the activity and looking at the references to this activity.
You could also use a tool called Leak Canary.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.