I use Glide library inner custom adapter view in my apps. But I have Error :
\"You must not call setTag() on a view Glide is targeting\"
T
If you have freedom to use other library, use, else you can use setTag(int, Object), but if you can't do above then wrap ImageView in a basic LinearLayout > setTag() on LinearLayout > setOnClickListener on LinearLayout.
Something like :
LinearLayout imgViewLinearLayout = new LinearLayout(context);
imgViewLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
imgViewLinearLayout.setId(R.id.dummy_image_layout);
imgViewLinearLayout.setOnClickListener(this);
ImageView imageView = new ImageView(inflater.getContext());
imageView.setPadding(0,15,20,0);
imageView.setId(R.id.imageview_for_glide);
imgViewLinearLayout.setTag("Image VIEWTAG");
imgViewLinearLayout.addView(imageView)
Override onClick and :
@Override
public void onClick(View v) {
if(v.getId() == R.id.dummy_image_layout){
//Do what you wanna wanted to do on click of ImageView
}
}
Hope this helps.