How to show and quit from unrecoverable error
What do people recommend for exiting a program when, say, a 'try/catch' results in an error?
Some people suggested System.exit(1); but others say this causes instability, but I'm really not clear on what should be done easily. Lots of stuff about intents and jframes (not android?) stuff, but there should be an easy way to just stop.
And secondarily, what's the best way to do a me开发者_Go百科ssage just before shutdown? Is there some kind of pop-up message capability, something like Toast, but that doesn't stay up very long, it'd be nice to have something that just works - no fussing around with intents and stuff.
If you are in your activity, a toast should work fine. As for cleanup, you can try to call finish() in your activity and/or stopself() from your service(s). Could also use stopService() if appropriate.
精彩评论