Skip to content Skip to sidebar Skip to footer

Listview Item Duplicate On Scroll Down

I'm getting items duplicate on scroll down or switch to landscape mode, I've been reading some post about this subject before posting this new one, but the most of them explain the

Solution 1:

Try this code in your adaptor getView

public View getView(int position, View convertView, ViewGroup parent) {
    Fila1view=null;
    Item_Venta_Gasto itm;
    if(convertView==null) {
                view = newFila1();
                LayoutInflaterinflator= (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                convertView = inflator.inflate(R.layout.gasto_item, null);
                view.fecha = (TextView) convertView.findViewById(R.id.rowDate);
                view.descripcion = (TextView) convertView.findViewById(R.id.rowDescription);
                view.saldo = (TextView)convertView.findViewById(R.id.rowPrice);
                convertView.setTag(view);
    }else{
        view = (Fila1) convertView.getTag();
    }
    itm = arrayitms.get(position);
    view.fecha.setText(itm.getFecha());
    view.saldo.setText(itm.getSaldo()+"BsF");
    switch (tipo){
        case0:
            view.descripcion.setText(itm.getConcepto()+" - "+itm.getDescripcion());
            break;
        case1:
            view.descripcion.setText(itm.getCliente()+" "+itm.getCantidad()+" "+itm.getProducto());
            break;
    }
    return convertView;
}

Hope this helps!

Post a Comment for "Listview Item Duplicate On Scroll Down"