Skip to content Skip to sidebar Skip to footer

Execution Order Of OnActivityResult And OnResume

I understand that OnActivityResult should be called immediately before OnResume in an Activity but that's not happening for me. I'm finding it gets called before OnResume, and even

Solution 1:

Looking at API-23 android.app.ActivityThread#performResumeActivity it calls #deliverResults() before doing Activity#performResume().

The former eventually calls Activity#onActivityResult() while the latter will call Activity#onStart() if it hasn't been started. Thus, the order of invocation will be:

onActivityResult()
onStart() // only if it has been stopped
onResume()

This seems to be the case all the way back to Android 2.0. Although there are posts that claim otherwise.


Solution 2:

This happens when your activity is set as "singleInstance". Is your activity singleInstance. Try removing it.


Post a Comment for "Execution Order Of OnActivityResult And OnResume"