Simpletarget is deprecated glide?
From Glide documentation
Use CustomViewTarget if loading the content into a view, the download API if in the background, or a CustomTarget for any specialized use-cases. Using BaseView is unsafe if the user does not implement BaseTarget.onLoadCleared(android.graphics.drawable.Drawable), resulting in recycled bitmaps being referenced from the UI and hard to root-cause crashes.
This worked for me:
Glide.with(this)
.asBitmap()
.load(uri)
.apply(options)
.into(new CustomTarget() {
@Override
public void onResourceReady(@NonNull Object resource, @Nullable Transition transition) {
mBackgroundManager.setBitmap((Bitmap)resource);
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) { }
});
Instead of SimpleTarget we use CustomTarget
Glide.with(this)
.asBitmap()
.load(uri)
.error(R.drawable.no_result)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
imageView.setImageBitmap(resource);
imageView.buildDrawingCache();
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) { }
});