Bring application to foreground same as Pressing the application in the recent activity?

341 views Asked by At

How can I bring my application back to foreground, same as when the user presses on the application icon/image in the recents activity.

2

There are 2 answers

3
David Wasser On BEST ANSWER

You just do what Android does when the user presses the application icon/image:

Intent intent = new Intent(context, MyRootActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

Make sure that you specify the root activity of your application (ie: the one with ACTION=MAIN and CATEGORY=LAUNCHER).

0
prijupaul On

Do you need to bring back your app based on some global keyevents?

Couple of things that came in my mind.. You can to write a view and listen to the global touch. Something like this thats stated in example