Skip to content Skip to sidebar Skip to footer

Android Webview Get Clicked Images Links?

i have small project its content listview and each item inside listview content html webview and the webview content text and images my problem is i can't get the image src on clic

Solution 1:

One way is if you are using shouldOverrideUrlLoading() then you can check the url for image types:

public class MyWebViewClient extends WebViewClient {

  @Override
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if(url == null){
      return false;
    }else if (url.trim().toLowerCase().endsWith(".img")) {//use whatever image formats you are looking for here.
      String imageUrl = url;//here is your image url, do what you want with it
    }else{
      view.loadUrl(url);
    }
  }
}

Post a Comment for "Android Webview Get Clicked Images Links?"