Hi, I have non-standard picture files, so I have to use custom decoder() .
this works fine when I load into imageview.
but now I need the bitmap file. so I want to load it into SimpleTarget
what should I do?
this is my code:
Glide.with(getActivity())
.load(url)
.decoder(new MyGlideDecoder(poetry))
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.asBitmap() // There is no such method
.into(new SimpleTarget<Bitmap>(100, 100) {
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation anim) {
// Do something with bitmap here.
}
});
Put asBitmap right after load and then see what methods you get with dot-completion.
Btw, Simple target may be error prone. Consider the pattern shown in FutureTarget JavaDocs
I am having the same problem with Glide 4.4:
unresolved reference asBitmap
@IgorGanapolsky
Glide.with().asBitmap() on 4.0+
// Put asBitmap() right after Glide.with(context) ,,. 4.0+
Glide.with(context)
.asBitmap()
.load(images[position])
.apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.AUTOMATIC))
.into(new SimpleTarget
@Override
public void onResourceReady(Bitmap bitmap, Transition super Bitmap> transition) {
SubsamplingScaleImageView.setImage(ImageSource.bitmap(bitmap)); //For SubsamplingScaleImageView
}
});
Most helpful comment
@IgorGanapolsky
Glide.with().asBitmap()on 4.0+