Restoring state in Android when using the 'up' button -


i using onsaveinstancestate() store arraylist member variable , restore in oncreate() method of main activity. works in circumstances such rotating screen etc. if open new activity , use 'up' button (not button) navigate main screen seems create new main activity without passing state bundle in oncreate().

i have confirmed when button pressed ondestroy() method called original instance of main activity makes no sense me because want resume existing activity if had pressed button rather create new one.

is there way can force new activity restore old 1 or resume existing activity?

try setting main activity's launch mode singletop, in manifest:

<activity android:name="activityname" android:launchmode="singletop" ... /> 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -