I am trying to make a task switch, and I succeeded. My only problem is that when I start actions, they restart because they are new actions (for example, I write an email, I click on the house and go into my activity, I start the email, and then the application starts by email to your inbox and email will be lost). So not true multitasking.
Here are my steps:
1) getting all running applications:
List<ActivityManager.RunningTaskInfo> allTasks = activityManager.getRunningTasks(30);
2) receipt of intent:
for (ActivityManager.RunningTaskInfo aTask : allTasks) {
Intent i = new Intent(Intent.ACTION_MAIN);
i.setComponent(aTask.baseActivity);
(...)
3) Launch the application by clicking on the button:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED).addCategory(Intent.CATEGORY_LAUNCHER);
monthis.startActivity(intent);
`
What is wrong with this code? Do I have to do something else to get it?
Thanks so much for any answer.