如何避免在默认的Andr​​oid浏览器中加载本地网页在新标签 [英] How to Avoid Loading Local Page in New Tab on Default Android Browser

查看:192
本文介绍了如何避免在默认的Andr​​oid浏览器中加载本地网页在新标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的这相反:<一href=\"http://stackoverflow.com/questions/4119084/android-browser-open-several-urls-each-on-new-window-tab-programmatically\">Android浏览器:打开几个网址,每个新窗口/标签(编程)

在那里,答案是使用b.putBoolean(new_window,真正的);但对于同一​​选项卡或同一窗口中相当于是什么?

In there, the answer was to use b.putBoolean("new_window", true); but what is the equivalent for same tab or same window?

出于某种原因,我只是有在平板电脑这个问题(在3.1和4.0.3测试)。我们正确地打开手机上的同一窗口或同一选项卡上的网址。

For some reason I'm only having this issue on tablets (tested on 3.1 and 4.0.3). We open URLs correctly on the same window or same tab on phones.

请不要告诉我使用web视图,我想要做的是做事情的背景,而一个用户是在默认的Andr​​oid浏览器浏览。

Please don't tell me to use a webview, what I'm trying to do is do things in the background while a user is browsing on the default Android browser.

感谢。

推荐答案

好吧,我找到了修复。基本上,手机运行2.3和更低的使用 com.android.browser ,与活动名称 com.android.browser.BrowserActivity 。我相信,在3.0,ApplicationIDs进行了介绍。

Okay I found the fix. Basically, phones running 2.3 and lower use com.android.browser, with activity name com.android.browser.BrowserActivity. I believe in 3.0, ApplicationIDs were introduced.

片仍然使用相同的浏览器程序包的名称,但有一个的applicationID com.android.browser ,而ICS 4.0.2以上使用com.google.android.browser作为包名称, com.google.android.browser 作为APPID(相同的活动名称使用)。所以我不得不添加到我的BrowserData。

Tablets still use the same Browser package name, but has an ApplicationID of com.android.browser, while ICS 4.0.2+ uses com.google.android.browser as the package name, and com.google.android.browser as the appId (same Activity name is used). So I just had to add that into my BrowserData.

在这之后,你必须使用自己的浏览器意图 EXTRA_APPLICATION_ID 标志,以避免新的标签自动打开。更多关于这里: http://developer.android.com/reference/android/供应商/ Browser.html

After this, one must use the EXTRA_APPLICATION_ID flag on their browser intent to avoid the automatic opening of a new tab. More on that here: http://developer.android.com/reference/android/provider/Browser.html

这篇关于如何避免在默认的Andr​​oid浏览器中加载本地网页在新标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆