android - View taking the place/position of another view in custom adapter -


i have list of images i'm showing, using universal image loader, i'm trying put ad in between in position 4, ad replacing image in position.. when looking @ positions , urls seems ok. there wrong custom adapter? or possible in xml?

 @override     public view getview(int position, view convertview, viewgroup parent) {         int type = getitemviewtype(position);         system.out.println(position+" "+urls.get(position));         if (convertview == null)          {             holder = new viewholder();              switch (type)             {                 case tilbud:                     convertview = minflater.inflate(r.layout.image_row, null);                     holder.imageview = (imageview)convertview.findviewbyid(r.id.image_row);                     imageloader.displayimage(urls.get(position), holder.imageview, options);                     break;                 case ad_space_1:                     convertview = minflater.inflate(r.layout.ad_space_row_1, null);                     adspace1 = (adspace)convertview.findviewbyid(r.id.ad_row_1);                     adspace1.setsid(returnsid(store, "ad1"));                     adspace1.setadeventlistener(adeventlistener);                     adspace1.setaderroreventlistener(aderrorlistener);                     adspace1.setadanimationeventlistener(adanimationlistener);                     adspace1.setadmediaeventlistener(admediaeventlistener);                     holder.adspace1 = adspace1;                     adspace1.runad();                     break;                 case ad_space_2:                     convertview = minflater.inflate(r.layout.ad_space_row_2, null);                     adspace2 = (adspace)convertview.findviewbyid(r.id.ad_row_2);                     adspace2.setsid(returnsid(store, "ad2"));                     adspace2.setadeventlistener(adeventlistener);                     adspace2.setaderroreventlistener(aderrorlistener);                     adspace2.setadanimationeventlistener(adanimationlistener);                     adspace2.setadmediaeventlistener(admediaeventlistener);                     holder.adspace2 = adspace2;                     adspace2.runad();                     break;             }             convertview.settag(holder);         }          else          {             holder = (viewholder)convertview.gettag();         }         return convertview;     }   } public static class viewholder  {     public imageview imageview;     public adspace adspace1, adspace2; } 

there wrong position of ads, needed +1 on ad1 , +2 on ad2.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -