让应用程序重新回到源程序

阅读 54

2023-06-21

List<ActivityManager.RunningTaskInfo> allTasks = activityManager.getRunningTasks(30);



for (ActivityManager.RunningTaskInfo aTask : allTasks) { Intent i = new Intent(Intent.ACTION_MAIN); i.setComponent(aTask.baseActivity); (...)


intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_REORDER_TO_FRONT.).addCategory(Intent.CATEGORY_LAUNCHER);

   monthis.startActivity(intent);




intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_REORDER_TO_FRONT.)


这个可以让活动重新回到原来的状态如我写一个an email, press home and go into my activity,launch email, and then the app launch the email bout goes back at the inbox and the email is lost


摘录


 


精彩评论(0)

0 0 举报