Friday, 18 September 2015

android parent activity destroyed


if you have a main list activity and a detail activity. you may find you main activity destroyed if you open detail and back.

There are two possible reasons for that, and two different solutions for these.

When you click a item on the main list page, the system will show your the detail activity.

1. the main list activity is destroyed after you clicked the item.

2. the main list activity is destroyed after you clicked the back button on the action bar of detail page.


If you encountered the first one you must using develop mode of your phone. You should check your developer setting




If you encountered the second one, you can fix it by add "android:launchMode="singleTop"" into you Androidmanifest.xml for your main list activity.


http://stackoverflow.com/questions/20325335/android-parent-activity-killed-on-startactivity

http://stackoverflow.com/questions/22182888/actionbar-up-button-destroys-parent-activity-back-does-not






No comments:

Post a comment