Os valores de texto são alterados no listview personalizado quando rola o listview no android?
Na minha aplicação estou usando a exibição de lista personalizada com visualização de texto, editar texto e botões.Quando clico no botão em "0" Th posição e estou alterar os valores de exibição de texto em "0" Th posição .quando eu rolar a lista -view os valores em "0" Th posição vista de texto alterado para o que nunca no estado inicial.
Minha classe de adaptador base
public class sample extends BaseAdapter{
public ArrayList<HashMap<String, String>> list;
Activity activity;
public sample(Activity activity,ArrayList<HashMap<String, String>> list) {
super();
this.activity = activity;
this.list = list;
}
public int getCount() {
// TODO Auto-generated method stub
return list.size();
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return list.get(position);
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
class ViewHolder {
Button order;
TextView item_name, order_qty;
EditText et_quantity;
}
public View getView(final int position, View convertView,final ViewGroup parent) {
// TODO Auto-generated method stub
final ViewHolder holder;
LayoutInflater inflater = activity.getLayoutInflater();
if (convertView == null) {
convertView = inflater.inflate(R.layout.order_custom, null);
holder = new ViewHolder();
holder.order = (Button) convertView.findViewById(R.id.order);
holder.item_name = (TextView) convertView.findViewById(R.id.item_name);
holder.order_qty = (TextView) convertView.findViewById(R.id.order_count);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
try{
HashMap<String, String> map = list.get(position);
holder.item_name.setText(map.get("name"));
//Log.v("Available or not", ""+map.get("available"));
}catch(Exception e){
e.printStackTrace();
}
holder.order.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
//here am click the button to change order count text value
int qty = Integer.valueOf(""+holder.order_qty.getText().toString());
qty++;
holder.order_qty.setText(""+String.valueOf(qty));
}
});
return convertView;
}
}
Eu não sei porque os valores de texto mudaram para o estado inicial quando rolar a lista personalizada view.Can alguém sabe por favor me ajude a resolver este problema