In my android app i have 4 url for one single image. to check if url 1 is broken then go to url 2 and the same way until the end. i using Glide 4.3.1 for loading image like this :
private int checkAndShow4Image(Context context, View view, int img_id, String img_url) {
try {
GlideApp
.with(context)
.load(img_url)
.diskCacheStrategy(DiskCacheStrategy.DATA)
.error(R.drawable.ic_broken_image)
.fallback(R.drawable.ic_broken_image)
.transition(DrawableTransitionOptions.withCrossFade())
.into((ImageView) view.findViewById(img_id));
} catch (Exception e) {
e.printStackTrace();
return -1;
}
return 0;
}
the method is returning before of complete loading. what is the best way for waiting for do it?