Use glide to load bitmap to ImageView

后端 未结 1 481
终归单人心
终归单人心 2021-01-02 11:49

I would like to use Glide to load bitmap to ImageView after cropping and re-sizing a bitmap.

I don\'t want to use ImageView.setImageBitmap(bitmap); bec

相关标签:
1条回答
  • 2021-01-02 12:06

    You don't need AsyncTask to load image with Glide. Glide load image asynchronys. Try to use this code:

    Glide.with(mContext)
                    .load("http://example.com/imageurl")
                    .asBitmap()
                    .into(new SimpleTarget<Bitmap>() {
                        @Override
                        public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
                            // you can do something with loaded bitmap here
    
                            // .....
    
                            holder.mImageView.setImageBitmap(resource);
                        }
                    });
    
    0 讨论(0)
提交回复
热议问题