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
The error mentions the line that causes your error, in this case when you invoke the method
setTag()
of yourImageView
Apparently they plan to add that "feature" in version 4 of Glide.
More info: https://github.com/bumptech/glide/issues/370
Based on the error message:
For now using Glide , it does not allow to add a tag to the view in which the image will be loaded:
so removing this line solved my problem.