Skip to content Skip to sidebar Skip to footer

How To Hide My Application But Not Close/finish It

I would like to let user to leave my application by hiding it but not finishing it. I could call finish() in my main activity, but it takes some time to do that. It's not good for

Solution 1:

You could try to move your activity in the background

moveTaskToBack(true);

Solution 2:

If you need your app to continue running in the background, spawn the background code in a Service.

http://developer.android.com/reference/android/app/Service.html

Solution 3:

The best advice here is simply to start looking at all of the garbage collection the app has to do and make sure you only keep things (connections, etc) open for as long as absolutely necessary.

Point is to limit the amount of stuff the app has to do to finally shut down.

Post a Comment for "How To Hide My Application But Not Close/finish It"