android - Disappearing ImageView after scroll in GetView -


i have problem. have inflate listview icons , texts. items should have icons (imageview) (with text1...text5) last item should haven't icon (text6). first image ok, second too, when scroll list (image 3) icon text1 disappear. again when scroll down list (image 4) icon text5 disappear...

enter image description here

   public class myadapter extends baseadapter { /* */     public view getview(final int position, view view, viewgroup parent) {             final viewholder holder;           if (view == null) {             view = layoutinflater.inflate(r.layout.list, null);              holder = new viewholder();              holder.textview1 = (textview) view.findviewbyid(r.id.text_view);             holder.imageview1 = (imageview) view.findviewbyid(r.id.icon);              view.settag(holder);          } else {             holder = (viewholder) view.gettag();         }  /*  */      //icons (text1 text5)      if (array[position].istrue()){         holder.imageview1.setimageresource(r.drawable.icon1);      }      else if (!array[position].istrue()){         holder.imageview1.setimageresource(r.drawable.icon2);      } /*   */     //last item equal -1 (text6)     if (array[position].getid == -1){         holder.imageview1.setvisibility(view.gone);     } 

 if (array[position].getid == -1){         holder.imageview1.setvisibility(view.gone);     }  else    {         holder.imageview1.setvisibility(view.visible);    } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -