AhmadNemati/ClickableWebView

How to get click of links

Opened this issue · 1 comments

Hi Ahmad,
Thanks for the nice

webview

.
I am developing an android app in which i need to make a webview where the links should be open in another activity. I don't how do i make this, I found your code on android-arsenal, I was trying to get the click of links not image, didn't understand how to do this. What do i use instead of IMAGE_TYPE in

if (listener != null && hr.getType() == IMAGE_TYPE) { listener.onClick(hr.getExtra()); }

Please help me to solve this problem.

You can extents your WebViewClient and override its method shouldOverrideUrlLoading. In that method, you can use codes as follows:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
mContext.startActivity(intent);