How can I do that in Android. Activity -> WebBrowser -> Acrivity, but Press Back not see the WebBrowser

前端 未结 5 1791
余生分开走
余生分开走 2020-12-18 04:02

How can I do that the web browser call a custom scheme to start a activity, then I want I press the Back Button but not return the web browser.

I just want to implem

5条回答
  •  甜味超标
    2020-12-18 04:36

    This probably happens because the second activity is launched into the same task you started the browser from, which means that starting your second activity returns to the already existing task with the topmost activity (activity 1) pushed to the back-stack. See here.

    If you make your second activity being started on a different task, pressing "back" should end that task and return to the task behind, the browser.

    To accomplish that, you could use FLAG_ACTIVITY_NEW_TASK in the intent starting activity 2, or set the activity's android:launchMode attribute to singleTop in your manifest.

提交回复
热议问题