All of my screens inherent from a screen with the following onClose() method:
public boolean onClose()
{
Dialog.alert("Closing");
done = true;
System.exit(0);
return true;
}
I kind of assumed that System.exit(0); would actually kill my application.
If I hit the red button to completely exit, I do get a "Closing" dialog message sucessfully. Same if I hit the back button too many times. But even if I get that "Closing" dialog, I'll still see my application running in the background when I select "Switch Application".
Not only that, if I have a thread running, sometimes I'll still see it going after I've quit the application (which is why I have that done variable set, so that my threads will automatically abort if done is true).
And on top of that, if the application crashes, I definitely don't see my dialog message, even if i manage to leave the application entirely. If I try to reclick the application after it's crashed, it doesn't reload, too. Ever. Is there anyway to gracefully handle that situation? (Obviously I have supplied error handling for every problem I've found, but if something happens in the wild, I want at least the application to not continue eating up memory)
Do Blackberry apps just never close? Am I doing something wrong? Right now if I want my application to stop running, I have to completely delete it and reinstall it!