描述状况如题目所说,问题是:1.activity 之间的先后状态有没有被保存恢复,换句话说不停点击返回键后之前的activity顺序是否正常?
2.点击返回键后触发的上个activity 的生命周期是什么,和正常的跳转返回有什么区别?
3.能否判断是否重要状态是否丢失?这个状态是否是保存在硬盘上的永远不会丢失的?如果不能保证然后如何实现整个应用的整体重新启动?
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
The author first learns about the launch mode launchMode, there are four types. The first problem is solved. launchMode
1> onRestart() --> onStart() --> onResume() 2> The situation is different depending on the launchMode of the Activity and Intent.setFlag. setFlag
You want to ask how to determine whether your app has been killed?
ActivityManager am = (ActivityManager) ct.getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> infos = am.getRunningTasks(100); for (int i = 0; i < infos.size(); i++) { RunningTaskInfo info = infos.get(i); if (info.baseActivity.getPackageName().equals(ct.getPackageName())) { if (info.numActivities != info.numRunning) return true; } } return false;
若程序被Kill掉,点多任务选择App,依旧启动清单文件中Search配置意图过滤<action android:name="android.intent.action.MAIN" />的Activity。 常见提升自身App内存中优先级,尽量避免被Kill的内容我就不回复了,流氓做法自己找,不传播
The author first learns about the launch mode launchMode, there are four types. The first problem is solved. launchMode
1> onRestart() --> onStart() --> onResume()
2> The situation is different depending on the launchMode of the Activity and Intent.setFlag. setFlag
You want to ask how to determine whether your app has been killed?