I have a main activity (Main) and another activity (Sub) that is called from Main by
startActivityForResult(new Intent(this, SubActivity.class), 25);
When I'm at Sub, and I kill the process (using a task manager or by adb shell kill <pid>
), and I re-open the application, I'm taken immediately to Sub.
In Sub I have this code to call back to the Main activity:
setResult(RESULT_OK, data);
finish();
I would have received the requestCode (25), the resultCode (RESULT_OK) and the data on onActivityResult
if I didn't kill the process. However in this case I'm taken to the Main activity, but the onActivityResult
is not called.
Is this how Android works (which I don't expect), or is there something wrong with my approach?
Update: This happened on my Nexus One, CyanogenMod 7.0.2, Android 2.3.3. I tried using emulator API 10, Android 2.3.4 and it worked as expected, onActivityResult
is still called after I killed the process.