Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide Activity without finish()

Tags:

android

I want my application to launch another activity/application (in this case, the Browser application), but currently when the user presses the Back button to exit the Browser, they return back to my Activity.

How can I make it so they do not come back to my activity after leaving the Browser, but if they relaunch my application later, the Activity stack of my application is as it was previously (i.e., cannot finish(), because that will remove the current Activity from the stack)?

like image 355
Bytecode Avatar asked Jun 14 '11 05:06

Bytecode


1 Answers

in Activity.onActivityResult() of the Activity that launched the Browser, call moveTaskToBack(true). Note: this requires that the Browser was launched with Activity#startActivityForResult()

like image 138
Bytecode Avatar answered Sep 25 '22 03:09

Bytecode