Hitesh Danidhariya
Hitesh Danidhariya

Reputation: 759

Want Bitmap from glide with gif thumbnail

I have a issue as Glide support for gif I am using gif as thumnail and loading url to imageview.Issue is I want the Bitmap from imageview in new SimpleTarget.

here is my code.

Glide.with(getApplicationContext()).load(url)
.thumbnail(Glide.with(getApplicationContext()).load(R.drawable.preloader))
.fitCenter()
.crossFade()
.into(Want bitmap here is it possible);

Upvotes: 0

Views: 1171

Answers (1)

remya thekkuvettil
remya thekkuvettil

Reputation: 798

Try the below code:

Glide.with(this)
            .load(url)
            .asBitmap()
            .placeholder(new ColorDrawable(ContextCompat.getColor(MainActivity.this, R.color.placeholder)))
            .error(new ColorDrawable(ContextCompat.getColor(MainActivity.this, R.color.placeholder)))
            .dontAnimate()
            .into(new SimpleTarget<Bitmap>() {
                @Override
                public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                    // resource: the required Bitmap
                }
            });

Upvotes: 1

Related Questions