Android - Keep previously added intent extra when going up to parent activity
If you have implemented up navigation as described in Providing up navigation on the android developers site, you should be able to fix the error simply by changing the launch mode for activity B to "singleTop.". Set this in the application's manifest.xml file, as follows:
<activity ... launchMode="singleTop" ... />
What's happening now, presumably because B's launch mode is standard, is that up navigation is launching a new instance of activity B; it doesn't get the extras that were provided originally by A.
When the launch mode is "singleTop" according to the linked document,
If the parent activity has launch mode singleTop, or the up intent contains FLAG_ACTIVITY_CLEAR_TOP, the parent activity is brought to the top of the stack, and receives the intent through its onNewIntent() method.
In onNewIntent(), I believe (please check this), that you can just ignore the new intent, because you want to continue using the intent from activity A.