android - Error "You must not call setTag() on a view Glide is targeting" when use Glide -


i use glide library inner custom adapter view in apps. have error :

"you must not call settag() on view glide targeting"  

this part of code :

 @override     public view getview(int position, view view, viewgroup container) {         viewholder holder;         if (view == null) {             holder = new viewholder();             view = holder.imageview = new imageview(context);             view.settag(holder);         } else {             holder = (viewholder) view.gettag();         }          holder.imageview.setadjustviewbounds(true);         linearlayout.layoutparams vp = new linearlayout.layoutparams(linearlayout.layoutparams.match_parent, linearlayout.layoutparams.match_parent);         holder.imageview .setlayoutparams(vp);         holder.imageview .setscaletype(imageview.scaletype.center_crop);          string var_news_article_images = imageidlist.get(getposition(position));          glide.with(context)                 .load(var_news_article_images)                 .placeholder(r.drawable.placeholder)                .into(holder.imageview);                 return view;     } 

so how fix ?

the key viewtarget.settagid; setting free default settag on imageview can use root in item layout. introduced in glide 3.6.0 in issue #370.

in manifest add this:

<application         android:name=".app" 

then create application context class:

public class app extends application {     @override public void oncreate() {         super.oncreate();         viewtarget.settagid(r.id.glide_tag);     } } 

add following contents src/main/values/ids.xml:

<resources>     <item type="id" name="glide_tag" /> </resources> 

(or add above <item ... /> resources xml in values)


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -