title: Android picasso check if image url exist before load into imageView
body: <p>I'm currently working on RecyclerView with data binding implement, to load Image from a list of url (/images/slider/my/myImage.jpg) get from API.</p>
  
  <pre><code>@BindingAdapter("imageUrl")
  public static void loadImage(ImageView imageView, String imageUrl){
      Picasso.with(imageView.getContext()).load(CommUtils.WEBSITE_LINK + imageUrl).into(imageView);
  }
  </code></pre>
  
  <p>Currently i have the code above in my ListAdapter. The code able to load the image fine when the url is in correct link or exist in server else it will it as blank. Therefore, i want to create a case that will check if the image is exist/is correct link before display.</p>
  
  <p>What i want to achieve is:</p>
  
  <pre><code>if(Image Link exist){
  //Load Image, Picasso.with.................
  } else {
  //Use Dummy Photo, Picasso.with..................
  }
  </code></pre>
  
  <p>[Edit] So now i know i can use the error() function to create another load if the path is not exist. How about when in a case that my API will return two difference format or "url" which could be; with path (/images/slider/my/myImage.jpg) or without path (myImage.jpg)
  Therefore in my code i want to do something like</p>
  
  <pre><code>if(websitelink + ImageUrl){ load image }
  else(websitelink + path + ImageUrl) { load iamge} //Should this code run under error() from the first case??
  </code></pre>
  
  <p>Can i perform a <b> checking on the ImageUrl first </b> instead of try to load the image directly and only change when is error</p>