tags:

views:

61

answers:

2

Can someone clarify - if in my activity, I leave to call an intent via startActivityForResult (such as take a picture), when users return to my app, what is the entry point for that activity? Is it onCreate, onStart, or onResume?

Thanks!

+2  A: 

Normally, it will be onResume() followed by onActivityResult(). However it's possible, though unlikely, that the calling activity will have been killed at some point while the user worked with the other activity; this happens when the system runs out of memory, at which point it starts killing stuff, starting from the 'most inactive'. In that case, I imagine it would go through onCreate(), onStart(), onResume() and then finally onActivityResult().

The exact callback for onActivityResult() is:

protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
    super.onActivityResult(requestCode, resultCode, data); 
    //Your code here
}
Steve H
+3  A: 

If the original activity is never stopped, it reenters via onResume(). If it is stopped it reenters via onRestart() -> onStart() -> onResume().

startActivityForResult shouldn't stop the original activity.

King Isaac