Skip to content Skip to sidebar Skip to footer

Get Event Click Link In A Webview Android

I have a webview and have some links in that webview.Now,I need that when i click a link in webview,a dialog is show...How must I do?

Solution 1:

wv.setWebViewClient(newWebViewClient() {
    @OverridepublicbooleanshouldOverrideUrlLoading(WebView view, String url) {
                                                                 ^^^
          // HERE YOU GET urlreturnsuper.shouldOverrideUrlLoading(view, url);
      }
});

Solution 2:

You will need to create interfaces between your JavaScript code and client-side Android code. With that your JavaScript code can call a method in your Android code to display a Dialog.

There is a good example over here:

http://developer.android.com/guide/webapps/webview.html#BindingJavaScript

Post a Comment for "Get Event Click Link In A Webview Android"