title: Android List View Showing only one item from two
body: <p>I'am trying to make a ListView that contains two items (two textView's)</p>
  
  <p>Here is my code:</p>
  
  <p>Header XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal" 
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt; 
  
       &lt;TextView android:id="@+id/txtHeader"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="center_vertical"
          android:layout_alignParentTop="true"
          android:layout_alignParentBottom="true"
          android:textStyle="bold"
          android:textSize="22dp"
          android:textColor="#FFFFFF"
          android:padding="10dp"
          android:text="Shoping List"
          android:background="#336699" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Hers is the row XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="horizontal" 
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:padding="10dp"&gt;
  
       &lt;TextView android:id="@+id/prudctName"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:textStyle="bold"
          android:textSize="22sp"
          android:textColor="#000000"
       /&gt;
  
       &lt;TextView android:id="@+id/productAmount"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:textStyle="bold"
          android:textSize="22sp"
          android:textColor="#000000"
           /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the MAIN SCREEN XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" 
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="#FFFFFF"&gt; 
  
       &lt;ListView
          android:id="@+id/shoping_list"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the class that represents the object containing the two filed:</p>
  
  <pre><code>public class ShopingListItem
  {
      public String productName;
      public String procuctAmount;
      public ShopingListItem(String _productName,String _productAmount)
      {
          this.procuctAmount=_productAmount;
          this.productName=_productName;
      }
  
  }
  </code></pre>
  
  <p>Here is the Adapter class:</p>
  
  <pre><code>    public class ShopingListItemAdapter extends ArrayAdapter&lt;ShopingListItem&gt;
      {
  
          public Context context;
          public int layoutResourceId;
          public ShopingListItem[] items;
  
          public ShopingListItemAdapter(Context context,int layoutResourceId, ShopingListItem[] objects)
          {
              super(context, layoutResourceId, objects);
              this.context=context;
              this.layoutResourceId=layoutResourceId;
              this.items=objects;
          }
  
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
  
              View row = convertView;
              ShopingListItemHolder holder = null;
  
              if(row==null)
              {
                  LayoutInflater inflater = ((Activity)context).getLayoutInflater();
                  row = inflater.inflate(layoutResourceId, parent, false);
                  holder = new ShopingListItemHolder();
                  holder.productName=(TextView)row.findViewById(R.id.prudctName);
                  holder.productAmount=(TextView)row.findViewById(R.id.productAmount);
                  row.setTag(holder); 
              }
              else
              {
                   holder = (ShopingListItemHolder)row.getTag();
              }
  
               ShopingListItem item = items[position];
               String amount = item.procuctAmount;
               String name = item.productName;
               TextView v = holder.productAmount;
               TextView vv = holder.productName;
               holder.productAmount.setText(amount);
               holder.productName.setText(name);
  
              return row;
          }
           static class ShopingListItemHolder
              {
                  TextView productName;
                  TextView productAmount;
              }
  
  
      }
  </code></pre>
  
  <p>Here is the main activity:</p>
  
  <pre><code>public class ShopingListActivity extends Activity
  {
      private ListView listView1;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.shoping_list_screen);
  
          //fill list with temp data
          ShopingListItem[] items = fillData();
          ShopingListItemAdapter adapter = new ShopingListItemAdapter(this, R.layout.listview_item_row, items);
  
          listView1 = (ListView)findViewById(R.id.shoping_list);
  
          View header = (View)getLayoutInflater().inflate(R.layout.listview_header_row, null);
          listView1.addHeaderView(header);
          listView1.setAdapter(adapter);
  
      }
  
      private ShopingListItem[] fillData()
      {
           ShopingListItem[] items = new ShopingListItem[]
                      {
                         new ShopingListItem("Bamba", "2"),
                         new ShopingListItem("Bisli", "12"),
                         new ShopingListItem("Shoko", "3"),
                         new ShopingListItem("Yello Cheese", "2"),
                         new ShopingListItem("Marak", "7"),
                         new ShopingListItem("Cola", "2"),
                         new ShopingListItem("Orez", "3"),
                         new ShopingListItem("Kaki", "9"),
                         new ShopingListItem("Battery", "1"),
                         new ShopingListItem("Bla", "1"),
                         new ShopingListItem("Bla bla", "100"),
                         new ShopingListItem("bbb", "200"),
                         new ShopingListItem("Red", "2"),
  
  
                       };
           return items;
      }
  }
  </code></pre>
  
  <p>The result of the code is a list but with only one item (the name) the amount isnt add'd</p>
  
  <p>Can anyone find the problem?</p>