1.简单粗暴的方式就是检测上到数据丢失了给用户重启,如果页面太多的情况保存数据势必不可行
/* 容易被销毁时候被调用
* @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
/* 实际被销毁后恢复
* @see android.app.Activity#onRestoreInstanceState(android.os.Bundle)
*/
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
FragmentManager.clearCache();
ApplicationUtil.exit();
// printLog(Const.PATH_TEMP_ON_SD_CARD_OF_APP + "d.txt", "后台被杀死了/r/n");
Intent intent =new Intent(this, ActivityLoading.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
super.onRestoreInstanceState(savedInstanceState);
}