作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
谁能告诉我如何在默认 webview 中打开 URL。我正在使用下面的代码,但它不起作用。它仍然提示选择 Intent 。这段代码在我的三星 S2 智能手机上运行良好。但不在 Galaxy 平板电脑中。
browser.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//check for key strings in URL to determine next action.
int useNativeIntent = 0;
int bolDone = 0;
//allow loading of this URL
if(useNativeIntent == 0){
showProgress("Loading..","This may take a moment if you have a slow internet connection.");
loadBrowser(url);
}
return true;
}
//loadBrowser
public void loadBrowser(String theUrl){
if(browser != null){
try{
browser.loadUrl(theUrl);
}catch(Exception je){
hideProgress();
showAlert("Error Loading?","There was a problem loading some data. Please check your internet connection then try again.");
}
}
}
最佳答案
除非您知道要触发的浏览器应用程序的 Activity 名称,否则您不能直接触发,这无论如何都不是一个好主意。
将选项留给用户,或者您可以在您的应用中实现您自己的类似浏览器的模块,并将用户直接带到您应用的浏览器。
关于android - 如何在不提示在 Android Honeycomb 中选择浏览器的情况下在 webview 中打开 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11572914/
我是一名优秀的程序员,十分优秀!