Reputation: 637
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;
}
});
Upvotes: 2
Views: 609
Reputation: 104
in the source of WebView define http:// as link prefix.
example:
<a href="http://yourdomain.x/">..</a>
Upvotes: 2
Reputation: 1433
Add the in your onClickListner
Button.setOnClickListener(new OnClickListener() { public void onClick(View v) { Uri uri = Uri.parse("http://google.com/"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } });
Upvotes: 0