Android listview item collapse while scrolling? -


i have created listiem text dynamically. based on array count. first time view created successful. while scrolling listview items collapsed. time text view showing repeated.

below have attached adapter code please check code,

  public class adapter extends baseadapter {  private arraylist<persondataclass> list; private context ctx; private layoutinflater minflater; private viewholder holder; private textview[] textview;  public adapter(context context, arraylist<persondataclass> personlist) {     // todo auto-generated constructor stub     minflater = layoutinflater.from(context);     ctx = context;     list = personlist; }  @override public int getcount() {     // todo auto-generated method stub     return list.size(); }  @override public object getitem(int arg0) {     // todo auto-generated method stub     return list.get(arg0); }  @override public long getitemid(int arg0) {     // todo auto-generated method stub     return arg0; }  @override public view getview(int arg0, view view, viewgroup arg2) {     // todo auto-generated method stub     if (view == null) {         view = minflater.inflate(r.layout.list_item, null);         holder = new viewholder();         holder.count = (textview) view.findviewbyid(r.id.likecount);         holder.flow_layout = (flowlayout) view                 .findviewbyid(r.id.flow_layout);         view.settag(holder);     } else {         holder = (viewholder) view.gettag();     }     try {         holder.count.settext("total votes count"                 + list.get(arg0).getprcnt());         int leftsize = list.get(arg0).getlist().size();         if (leftsize > 0 && leftsize <= 10) {             log.i("tag", "left votelist if" + leftsize + "arg0" + arg0);             textview = new textview[leftsize];             (int j = 0; j < leftsize; j++) {                 string str = "<font color=#409bf8>"                         + list.get(arg0).getlist().get(j).getrtuuname()                         + "</font> <font color=#74869c>" + "voted"                         + "</font> <font color=#dd095e>"                         + list.get(arg0).getlist().get(j).getrtval()                         + "</font>" + ",";                 textview[j] = new textview(ctx);                 textview[j].settext(html.fromhtml(str));                 textview[j].settextsize(9);                 holder.flow_layout.addview(textview[j]);             }         } else {             log.i("tag", "left votelist else" + leftsize + "arg0" + arg0);             textview = new textview[1];             textview[0] = new textview(ctx);             textview[0].settext("total rates " + list.get(arg0).getprcnt());         }     } catch (exception e) {         // todo: handle exception     }     return view; }  private class viewholder {     private textview count;     private flowlayout flow_layout; }  } 


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -