Android App Restarts upon Crash/force close

前端 未结 7 972
名媛妹妹
名媛妹妹 2020-12-07 10:10

My android app is getting restarted after force close, through my entire application which consist of 20 activities, I am relying on static data created on a main activity.

相关标签:
7条回答
  • 2020-12-07 10:43

    If the user is force stopping your app (from Settings > Apps > App Info, or from the recent apps list) or the operating system is stopping your app, then you can save whatever you need using onSaveInstanceState().

    However, if your app is crashing, then there's not much you can do about it (apart from periodically saving important stuff to preferences/databases/etc.). It is probably better to focus on preventing crashes, rather than trying to handle crashes!

    0 讨论(0)
提交回复
热议问题