title: Android custom ArrayAdapter getView method called multiple times - resetting dynamic TextView value
body: <p>The getView method in my custom ArrayAdapter is getting called multiple times, which I assume it is meant to. Problem is, I have a quantity TextView which is dynamically set but when you scroll and the box goes off screen the value disappears. I am not sure what I am doing wrong and Google is not proving to be much help. Hopefully someone here can help me.</p>
  <p>The adapater is called:</p>
  <pre><code>adapter = new MenuAdapter(thisActivity, R.layout.menu, list);
  setListAdapter(adapter);
  </code></pre>
  <p>My Custom ArrayAdapter:</p>
  <pre><code>public MenuAdapter(Context context, int textViewResourceId, ArrayList&lt;Object&gt; menu) {
      super(context, textViewResourceId, menu);
      this.menu = menu;
      vi = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
      
      public View getView(int position, View convertView, ViewGroup parent) {
              View v = convertView;
            
              Object cat = menu.get(position);
              if (cat.getClass().equals(Category.class)) {
                  v = vi.inflate(R.layout.category, null);
                  Category item = (Category)cat;
                  v.setOnClickListener(null);
              v.setOnLongClickListener(null);
              v.setLongClickable(false);
              
                  TextView tt = (TextView) v.findViewById(R.id.category);
                  tt.setText(item.getName());      
           
              } else if (cat.getClass().equals(OrderItem.class)) {
                  v = vi.inflate(R.layout.menu, null);
                  OrderItem orderItem = (OrderItem)cat;
                  Item item = orderItem.getItem();
                  TextView tt = (TextView) v.findViewById(R.id.title);
                  tt.setText(item.getName());   
                  
                  TextView bt = (TextView) v.findViewById(R.id.desc);
                  bt.setText(item.getDescription());
                  
                  TextView qty = (TextView) v.findViewById(R.id.qty);
                  qty.setId(item.getId());
                  
                  
                  ImageButton minus = (ImageButton) v.findViewById(R.id.qtyMinus);
                  minus.setTag(item);
                  ImageButton plus = (ImageButton) v.findViewById(R.id.qtyPlus);
                  plus.setTag(item);          
              }
              
              return v;
      }
  </code></pre>
  <p>The menu layout:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;fill_parent&quot;
      android:layout_height=&quot;?android:attr/listPreferredItemHeight&quot;
      android:padding=&quot;6dip&quot;
      android:background=&quot;#FFFFFF&quot;&gt;
          
      &lt;RelativeLayout
          android:orientation=&quot;vertical&quot;
          android:layout_width=&quot;0dip&quot;
          android:layout_weight=&quot;1&quot;
          android:layout_height=&quot;fill_parent&quot;
          android:cacheColorHint=&quot;#FFFFFF&quot;
          android:background=&quot;#FFFFFF&quot;&gt;
  
          &lt;TextView
              android:id=&quot;@+id/title&quot;
              android:layout_width=&quot;fill_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot;
              android:gravity=&quot;center_vertical&quot;
              android:textSize=&quot;16px&quot;
              android:textColor=&quot;#000000&quot;
          /&gt;
          &lt;TextView
              android:id=&quot;@+id/desc&quot;
              android:layout_below=&quot;@id/title&quot;
              android:layout_width=&quot;fill_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_weight=&quot;1&quot;
              android:textSize=&quot;11px&quot;
              android:textStyle=&quot;italic&quot;
              android:textColor=&quot;#000000&quot;
          /&gt;
      &lt;/RelativeLayout&gt;
      &lt;ImageButton
      android:id=&quot;@+id/qtyMinus&quot;
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:src=&quot;@drawable/minus&quot;
      android:paddingTop=&quot;15px&quot;
      android:onClick=&quot;minusQty&quot;  /&gt;
      &lt;TextView
      android:id=&quot;@+id/qty&quot;
      android:layout_width=&quot;50px&quot;
      android:layout_height=&quot;50px&quot;
      android:textColor=&quot;#000000&quot;
      android:textSize=&quot;18px&quot;
      android:gravity=&quot;center_vertical|center_horizontal&quot;
      android:freezesText=&quot;true&quot;
      android:background=&quot;@android:drawable/editbox_background&quot;/&gt;
      &lt;ImageButton
      android:id=&quot;@+id/qtyPlus&quot;
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:src=&quot;@drawable/plus&quot;
      android:paddingTop=&quot;15px&quot;
      android:onClick=&quot;addQty&quot; /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>