Prevent an Activity from being killed by the OS while starting a child activity

Posted by Martin Marinov on Stack Overflow See other posts from Stack Overflow or by Martin Marinov
Published on 2010-06-18T10:16:20Z Indexed on 2010/06/18 10:23 UTC
Read the original article Hit count: 266

I have a main activity which calls a child one via

Intent I = new Intent(this, Child.class);
startActivityForResult(I, 0);

But as soon as Child becomes visible the main activity gets its onStop and immediately after that onDestroy method triggered. And as soon as I call finish() within the Child activity or press the back button, the Child activity closes and the home screen shows (instead of the main activity).

How can I prevent the main activity from being destroyed? :\

© Stack Overflow or respective owner

Related posts about java

Related posts about android