Reputation: 32233
I'm trying to guess why, if I open my application, lock the device and some hours later resume the activity it crashes. I suppose thats why, after some time, Android destroy my app and then tries to resume and im not saving correctly the state of my activities.
How can I force Android to destroy my app as it does usually without having to wait hours?
Thanks in advance
Upvotes: 1
Views: 184
Reputation: 2374
If you finish(
) your Activities and stop your services the process should be finished.
Of course is someone presses the menu button your activities will only be paused and not finished()
'd and when you come back their state may have been taken for other memory which you should check for when they come back.
Upvotes: 0
Reputation: 811
You have both an onCreate() and onResume() method available to you as well as onPause() and onDestroy(). If you manage the life cycle properly with those methods (life cycle detailed here) you should be able to eliminate the crash.
I'm guessing you do some setup in the onCreate() method that you should really be doing in onResume().
Upvotes: 4
Reputation: 74780
You can use Development tools:
http://developer.android.com/guide/developing/debugging/debugging-devtools.html
Note the feature "Immediately destroy activities". You should be able to use it in android emulators.
Upvotes: 3