I’d like to implement the following behavior for the up-button:
- If an instance of the parent activity is on the back stack, return to the top-most instance of that parent activity.
- If there is no instance of the parent activity on the back stack, create a new instance.
Actually, when I first read about the difference between up and back, this behaviors was what I expected as default. However, I have seen now, that NavUtils.navigateUpFromSameTask(this); always creates a new instance of the parent activity, ignoring the fact, that there is one readily available on the back stack.
Thanks for any advice.
Try to specify launch mode for your activity in Manifest android:launchMode=”singleInstance” or android:launchMode=”singleTop” ,look at this question for more info Android launchmode="singleTask" does not work as expected