开发者

Android App Exits when Going into Background

Ever since I added a new Class to my Android app (specifically, a sqlite helper class) may app wants to relaunch after I press the home button. Before adding the class, the app would multitask as expected.

I am stumped. It seems onDestroy is called every time the app goes into the background.

Any tips or thoughts as to why this would happ开发者_C百科en?


This is by design. Please refer to Android activity lifecycle for more info when/how your activity could be destroyed. Basically, as soon as your app goes into background, your activity can be killed at any moment.

If you want to continue execution, you need to create a Service that represents a long-running components in Android architecture.


It turned out I had android:finishOnCloseSystemDialogs="true" in the manifest file.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜