There is little changes according to latest version of Glide
. Now we need to use submit()
to load image as bitmap, if you do not call submit()
than listener won't be called. In 4.0 Version, submit()
added and in order to invoke listener. One of user commented code is working with GlideApp
. You can use below code to run with GlideApp if you are using.
here is working example i used today.
Glide.with(cxt)
.asBitmap().load(imageUrl)
.listener(new RequestListener<Bitmap>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object o, Target<Bitmap> target, boolean b) {
Toast.makeText(cxt,getResources().getString(R.string.unexpected_error_occurred_try_again),Toast.LENGTH_SHORT).show();
return false;
}
@Override
public boolean onResourceReady(Bitmap bitmap, Object o, Target<Bitmap> target, DataSource dataSource, boolean b) {
zoomImage.setImage(ImageSource.bitmap(bitmap));
return false;
}
}
).submit();
It is working and i m getting bitmap from listener.