Skip to content Skip to sidebar Skip to footer

Stop Os From Killing My Process

I have an application in which I am calling ACTION_SEND intent from my main activity. Everything works fine but when I return to my main activity from ACTION_SEND intent then main

Solution 1:

I think its bcz a OS kills my activity to free up space

Possibly. You might be doing something yourself to destroy your activity (e.g., calling finish() after calling startActivity() for your ACTION_SENDIntent).

So is there any way rather than using Service So that I can stop OS from killing my activity ?

No. Even a service may not help. Your process can be terminated at any time, for any reason, including the user deciding to terminate it via a task manager or the recent-tasks list. Also, if the user rotates the screen or causes another configuration change while in whatever app they started via ACTION_SEND, your activity that called startActivity() with ACTION_SEND will be recreated due to the configuration change.

You cannot assume that onRestart() will be called. In general, I consider onRestart() to be a code smell for just this reason.

Post a Comment for "Stop Os From Killing My Process"