I need some help here. Basically, I have an Activity. This uses the startActivityForResult() method to call a second Activity (which is part of the same app). The result code for this second Activity returns RESULT_CANCEL before the onCreate() method of the second Activity is called.
This is bewildering me. If I change the Intent and call the Android Messaging App Activity and not my own Activity I get the result code correctly after that Activity finishes.
It’s pretty obvious to me that when you call your own Activity for a result you must do something different.
Testing on Android V2.2
Ok, so I have found the solution to this.
If you have a launchMode of “singleTask” or “singleInstance” then you cannot receive a result from an Activity that you launch from your application. It will return immediately as RESULT_CANCEL. By changing the launchMode of the Activity to “standard” or “singleTop” this problem is solved.
example:
instead of
I hope this helps out anyone who has the same problem.