HaKr HaKr - 1 year ago 69
Android Question

Sending Activity to background with out finishing

How can I make an activity go to background without calling its

method and return to the Parent activity that started this? I tried so much but I could not find a solution. So if you guys could help I would be very thankful.

Answer Source

The following will work if the Activity is running in a different task to its parent. To achieve this, see http://developer.android.com/guide/topics/manifest/activity-element.html#lmode.

public void onBackPressed () {
    moveTaskToBack (true);

The current task will be hidden, but its state will remain untouched, and when it is reactivated it will appear just as it was when you left it.