多数のスピナーを含むリストビューがありますが、リストビューをスクロールすると、スピナーの値がリセットされます。これを修正する方法はありますか?これは私のArrayAdapterクラスがどのように見えるかです。
public class ProductArrayAdapter extends ArrayAdapter {private final Context context;
private final List<Product> values;
public ProductArrayAdapter( Context context, List<Product> values ) {
super( context, R.layout.product_item, values );
this.context = context;
this.values = values;
}
@Override
public View getView( int position, View convertView, ViewGroup parent ) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
View rowView = inflater.inflate( R.layout.product_item, parent, false );
Product availableProduct = values.get( position );
((TextView) rowView.findViewById( R.id.productCode )).setText( Product.getProductName( availableProduct.getProductCode( ) ) );
((Spinner) rowView.findViewById( R.id.count )).setAdapter( productCounts );
return rowView;
}
}