android studio : Cannot find symbol Class GlideDrawable

后端 未结 2 932
無奈伤痛
無奈伤痛 2020-12-18 23:24

i\'m having an issue with this project whenever i try to compile it displays the error

Error: cannot find symbol class GlideDrawable

相关标签:
2条回答
  • 2020-12-18 23:52

    GlideDrawable is depreciated in 4.x version so if you are moving from 3.x to 4.x simple use Drawable.

    For example if you are using listener somewhere in code then move to simple this method..

     .listener(new RequestListener<Drawable>() {
                    @Override
                    public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                        progressBar.setVisibility(View.GONE);
                        return false;
                    }
    
                    @Override
                    public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                        progressBar.setVisibility(View.GONE);
                        return false;
                    }
                })
    
    0 讨论(0)
  • 2020-12-19 00:08
       String imagePosterUrl=AppStrings.BASE_POSTER_PATH+movie.getPosterPath();
            ImageView ivPoset=holder.ivMoviePoster;
    
            Glide.with(activity).load(imagePosterUrl).addListener(new RequestListener<Drawable>() {
                @Override
                public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                    return false;
                }
    
                @Override
                public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
    
                    //if you want to convert the drawable to ImageView
                    Bitmap bitmapImage  = ((BitmapDrawable) resource).getBitmap();
    
    
    
                    return false;
                }
            }).into(ivPoset);
    

    This code for Glide version 4.8.0. You can update the version 4.8.0 and also update this code for getting drawable or Bitmap. Because of Simple Target and ViewTarget Class in glide deprecated.

    0 讨论(0)
提交回复
热议问题