In my application , i had wierd problem that when app goes background (press home button) , then i should restart my app when it comes to foreground , Instead of getting previous state.
Can any one help me to sort out this.
EDIT:
i explain my problem clearly,I am having four Activities A1,A2,A3,A4.
A1 - ListActivity - loading events from server. A2 - SearchActivity A3- EventDetail page
See if i was currently in A3 then i went to background, when i come to forground i should display A1 (Again i have update data from server). Finally i want restart app.
Reg开发者_如何学运维ards, Srinivas
Try to set in the manifest file for your homeActivity the "android:clearTaskOnLaunch" property to true. In this way when you press the home button, once the application is restarted it will display your homeActivity instead of the last started activity.
I do the same thing in an app I made. Basically I just used the onResume function that is called when the app comes into the foreground from the background to restart the activity. Just add that and restart the activity and your app will restart each time you load it (which I believe is what you want).
精彩评论