I have a listview that contains a bunch of spinners, but when I scroll the listview, the value for the spinner is reset. Is there a way to fix this? This is what my ArrayAdapter class looks like.
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;
}
}