Hamidreza Samadi Hamidreza Samadi - 4 months ago 14
Android Question

Opening WebView links in default browser

I want to open my

WebWiew
links in default browser. I used this code but it did not work. Even the log did not show up.

webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {

Log.d("urlLoading",url);
view.getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true;
}
});

Answer

in the source of WebView define http:// as link prefix.

example:

<a href="http://yourdomain.x/">..</a>