androidrelaunch

How to relaunch application when app went to background to foreground in android?


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.

Regards, Srinivas


Solution

  • 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.