Glide, I get the error message: "java.lang.IllegalArgumentException: You must not call setTag () on a view Glide is targeting"

4

When trying to load an image using Glide , inside an ImageView, ensuring to have the path of the image in urlImage and the instance of the ImageView in imgZoom , this is my code:

private View individual(LayoutInflater inflater, ViewGroup container) {
        View v = inflater.inflate(R.layout.fragment_image_zoom, container, false);
        final View pbr = v.findViewById(R.id.PhotoDetail_pbr_main);
        imgZoom = (ZoomImageView) v.findViewById(R.id.PhotoDetail_tiv_main);
        imgZoom.setTag(urlImage);
        imgZoom.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                View layTextPie = getActivity().findViewById(R.id.textViewFooter);
            }
        });
    Glide.with(inflater.getContext())
            .load(urlImage)
            .into(imgZoom);
        }
        return v;
    }

I get the following error message:

  

java.lang.IllegalArgumentException: You must not call setTag () on a   view Glide is targeting

    
asked by Elenasys 10.02.2016 в 04:32
source

2 answers

0

Based on the error message:

  

java.lang.IllegalArgumentException: You must not call setTag () on a   view Glide is targeting

For now, using Glide , you can not add a tag to the view in which will load the image:

 imgZoom.setTag(urlImage); 

so by eliminating this line I solved my problem.

    
answered by 17.02.2016 / 22:19
source
5

The error mentions the line that causes your error, in this case when you invoke the method setTag() of your ImageView

imgZoom.setTag(urlImage); //Eliminar o comentar esta linea

Apparently they plan to add that "feature" in Glide version 4.

More information: link

    
answered by 10.02.2016 в 18:26