gpt4 book ai didi

android - 如何在不提示在 Android Honeycomb 中选择浏览器的情况下在 webview 中打开 URL

转载 作者:行者123 更新时间:2023-11-29 22:02:39 24 4
gpt4 key购买 nike

谁能告诉我如何在默认 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com