I’m working on an Android application. Our problems manifest when the user runs our app, navigates away via the home or back button, and comes back later. From the official Android activity lifecycle documentation and Eric Burke’s helpful reformatting of the lifecycle diagram, I suspect that our activity is begin killed while stopped, but (critically) not destroyed.
In other words, from running, the functions called are onPause(), onStop(), onRestart(), onStart(), and onResume(). Note, importantly, that this means that onRestart() is being called in the middle instead of onCreate(), which would happen if the app were just killed and removed from memory. This, I think, is the problem.
That’s the setup. Here’s the question: is there any way that I can reliably force the application to be stopped so that I can reproduce this condition. I don’t want to kill the app, and I don’t want it to just be paused.
Is there an ADB command? DDMS? Something in the phone?
I’ve tried faking it by running other memory-hungry apps, but that always just leads it getting killed outright, which means the app gets started all over and onCreate is run and I don’t learn anything.
Press the HOME button.