Issue
I'm testing the built-in WebView in the Android apps. My problem is that the following code
WebView webView = (WebView) findViewById(R.id.webView1);
webView.loadUrl("http://google.com");
triggers an intent (sugesting the installed browsers for opening the web) instead of open it in the built-in WebView. What should I do for avoiding that?
Solution
WebView mWebView= (WebView) findViewById(R.id.webView1);
mWebView.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
// Handle the error
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
mWebView.loadUrl("http://google.com");
This won't open other broweser. Have reference here from DEVELOPER's SITE.
Answered By - Bhavin
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.