Recovery from Android app will be killed

What's happening:

  • I open my application and then press the home button to leave it for a moment.
  • I go in Settings > Applications > Manage Applications > Running, find my application in the list of cached background applications and stop it.
  • Then I hold the Home button and select my application in the list of recent applications to start it again.

[Note. These steps are just my way to get the same symptoms as the testers do — they just go in and out of the app without causing it to close.]

It opens with activity in which I left it, but in poor condition. The first problem was that the memory hold information was gone (which makes sense if the application is killed). I decided that by creating the User serializable class and saving the current user object in onSaveInstanceState, load it back into onCreate. In the same way, I had to recreate mine ClientConnectionManagerin order to work on the network again.

Restart activity is doing very well, and I can move around and use the newly created actions, but if I click the Back button instead to return to the activity that was created before I resolutely stopped the application, I get an exception saying that the User class does not exist (ClassNotFoundException, apparently when doing misuse).

? , , , ? , , ?

+3
3
+5

( , ), . , , , - . , . , , , .

, , . , . , , , , , , - .

+5

, User Parcelable. , , Bundle Serializable , ​​ , , .

Now my application is recovering after it was killed in the background. I boost @avimak and @Rajesh because both answers taught me a lot. Thank.

+1
source

All Articles