Issue
whey i wrote below code, the url is opening in the default browser, why its not loading in the my app.
setContentView(R.layout.activity_main);
myWebView = (WebView) findViewById(R.id.webView);
myWebView.loadUrl("http://www.google.com");
Solution
Try setting a WebViewClient on the WebView:
myWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
myWebView.loadUrl("http://www.google.com");
Answered By - Jason Robinson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.