开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜