Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Why GlideDrawableImageViewTarget is not found in Glide4+? What is the alternative?

My code:

import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
Glide.with(getContext())
                    .load(R.drawable.loader_gif_image)
                    .diskCacheStrategy(DiskCacheStrategy.NONE)
                    .into(new GlideDrawableImageViewTarget(imageView));
    Glide.with(this)
            .load("")
            .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
            .into(new DrawableImageViewTarget(imageView));
    // or use this
    Glide.with(this)
            .load("")
            .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
            .into(new CustomTarget<Drawable>() {
                @Override
                public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
                    imageView.setImageDrawable(resource);
                @Override
                public void onLoadCleared(@Nullable Drawable placeholder) {

Try this

You can use new SimpleTarget<Drawable>()

    Glide.with(this)
            .load(R.drawable.ic_favorite)
            .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
            .into(new SimpleTarget<Drawable>() {
                @Override
                public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
                    imageView.setImageDrawable(resource);

Try this

You can use new Target<Drawable>()

    Glide.with(this)
            .load(R.drawable.ic_favorite)
            .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
            .into(new Target<Drawable>() {
                @Override
                public void onLoadStarted(@Nullable Drawable placeholder) {
                @Override
                public void onLoadFailed(@Nullable Drawable errorDrawable) {
                @Override
                public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
                    imageView.setImageDrawable(resource);
                @Override
                public void onLoadCleared(@Nullable Drawable placeholder) {
                @Override
                public void getSize(@NonNull SizeReadyCallback cb) {
                @Override
                public void removeCallback(@NonNull SizeReadyCallback cb) {
                @Override
                public void setRequest(@Nullable Request request) {
                @Nullable
                @Override
                public Request getRequest() {
                    return null;
                @Override
                public void onStart() {
                @Override
                public void onStop() {
                @Override
                public void onDestroy() {
                @Alston sorry to hear that please check updated answer, for Glide:4.9.0 you need to use CustomTarget<Drawable>() instead of SimpleTarget<Drawable>()
– AskNilesh
                Sep 23, 2019 at 4:46

Update your dependency in build.gradle to implementation 'com.github.bumptech.glide:glide:4.5.0'

Try to import DrawableImageViewTarget instead of GlideDrawableImageViewTarget

Or Use code as below.

Glide.with(context).load(R.drawable.common_google_signin_btn_icon_dark).apply(new RequestOptions().placeholder(R.drawable.common_google_signin_btn_icon_dark)).into(new DrawableImageViewTarget(holder.profileImage));

Hope this will help

            @Override
            public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
            @Override
            public void onLoadCleared(@Nullable Drawable placeholder) {
                super.onLoadFailed(placeholder);
            @Override
            public void onLoadFailed(@Nullable Drawable errorDrawable) {
                super.onLoadFailed(errorDrawable);
        };```
            Glide.with(mContext)
                .load(item.getFriendUserPhotoUrl())
                .listener(new RequestListener<Drawable>() {
                    @Override
                    public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
                        fullname.setVisibility(View.VISIBLE);
                        progressBar.setVisibility(View.GONE);
                        imageView.setImageResource(R.drawable.profile_default_photo);
                        return false;
                    @Override
                    public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                        progressBar.setVisibility(View.GONE);
                        fullname.setVisibility(View.VISIBLE);
                        return false;
                .into(holder.thumbnail);
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.