1
任何人都可以告訴我如何在默認webview中打開一個URL。我正在使用下面的代碼,但它不工作。它仍然在提示選擇意圖。這段代碼在我的三星S2智能手機中工作正常。但不在Galaxy平板電腦中。如何在webview中打開URL而不提示在Android中使用瀏覽器選擇Honeycomb
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.");
}
}
}
變量'browser'是'WebView' rt的一個實例嗎? – sunil 2012-07-20 04:59:03
是的。這是webview。蜂窩行爲是不同的? – Harish 2012-07-21 17:22:12