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

前端 未结 5 1805
余生分开走
余生分开走 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:39

    I found that only Intent.FLAG_ACTIVITY_NO_HISTORY works only if the browser was not running before. If I restart Android and run my app which call browser everything work well. But when I start browser before my app, browser will stay in history.

    I tried add to manifest to activity definition android:launchMode="singleTop" according the user634618. But it doesn't work. I don't understand why singleTop should help.

    In documentation is also this:

    BlockquoteAs another example, the Android Browser application declares that the web browser activity should always open in its own task—by specifying the singleTask launch mode in the element. This means that if your application issues an intent to open the Android Browser, its activity is not placed in the same task as your application. Instead, either a new task starts for the Browser or, if the Browser already has a task running in the background, that task is brought forward to handle the new intent.

    I think that this cause the problem. But how to force run browser in current task?

提交回复
热议问题