Значения текста изменяются в настраиваемом просмотре списка при прокрутке просмотра списка в Android?
В моем приложении я использую настроенный вид списка с текстовым представлением, edit-text и кнопками. Когда я нажимаю кнопку в «0»Th позиция и меняются значения представления текста в «0»Эта позиция. Когда я прокручиваю вниз список-посмотреть значения в «0»Вид текста позиции изменился на исходный.
Мой базовый класс адаптера
public class sample extends BaseAdapter{
public ArrayList list;
Activity activity;
public sample(Activity activity,ArrayList 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 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;
}
}
я неНе знаю, почему текстовые значения изменились в исходное состояние при прокрутке вниз настроенного представления списка. Может кто-нибудь знает, пожалуйста, помогите мне решить эту проблему