Hide Activity without finish()
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)?
in Activity.onActivityResult()
of the Activity
that launched the Browser, call moveTaskToBack(true). Note: this requires that the Browser was launched with Activity#startActivityForResult()
You can't control that -- it's an inherent feature of the operating system, and you're talking about affecting behaviors of other applications. The best you can do is control the behavior of your own application. If you need fine-grained control over what you want the user to be able to do in the web browser, have you considered using a WebView instead?
精彩评论