I want to load GIF file on android app using java only without adding an imageview in xml file of the activity. I tried following approach but app crashes.I'm using Glide 4.+ version.
private Bitmap backgroundImg;
Glide.with(this)
.load(R.drawable.title.gif)
.asBitmap()
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<?super Bitmap> glideAnimation) {
backgroundImg = resource;
canvas.drawBitmap(backgroundImg, 0, 0, null);
}
});