我可以收我已经打开一个浏览器的活动? [英] Can I close a browser activity I've opened?
问题描述
我的应用程序中打开通过startActivity浏览器的活动()。我可以关闭该浏览器活动,如果我喜欢的感觉?
My app opens a browser activity via startActivity(). Can I close that browser activity if I feel like it?
首先,startActivity()不返回任何东西 - 我能得到一个活动对象返回从它在某种程度上
For one thing, startActivity() does not return anything - can I get an Activity object back from it somehow?
在JavaScript的世界中,惯例是谁打开了一个新的浏览器窗口,有权将其关闭。刚刚说的了。
In the JavaScript world, the convention is that whoever opened a new browser window has the authority to close it. Just sayin'.
推荐答案
概述<一href="http://stackoverflow.com/questions/3217942/android-intent-flag-activity-single-top-and-intent-flag-activity-clear-top">here,如果激活根系活力有以下意图的标志:
As outlined here, if you activate the root activity with the following intent flags:
Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP
这将完成它的顶部导航堆栈中的所有活动。包括浏览器。
it will finish all activities on top of it in the navigation stack. Including the browser.
这篇关于我可以收我已经打开一个浏览器的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!