title: ArrayAdapter requires ID to be a TextView error
body: <p>I am trying to create a nice layout for my list items, but my code only works when it is simplified like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:padding="10dp"
      android:textSize="16sp" &gt;
  &lt;/TextView&gt;
  </code></pre>
  
  <p>When I add a little bit more it compiles and runs but it force closes on start and gives me the error <code>ArrayAdapter requires ID to be a TextView</code>:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="?android:attr/listPreferredItemHeight"
      android:padding="6dip" &gt;
  
      &lt;ImageView
          android:id="@+id/icon1"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent"
          android:layout_alignParentBottom="true"
          android:layout_alignParentTop="true"
          android:layout_marginRight="6dip"
          android:src="@drawable/ic_launcher" /&gt;
  
      &lt;TextView
          android:id="@+id/secondLine"
          android:layout_width="fill_parent"
          android:layout_height="26dip"
          android:layout_alignParentBottom="true"
          android:layout_alignParentRight="true"
          android:layout_toRightOf="@id/icon1"
          android:ellipsize="marquee"
          android:singleLine="true"
          android:text="Some more information" /&gt;
  
      &lt;TextView
          android:id="@+id/textView1"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_above="@id/secondLine"
          android:layout_alignParentTop="true"
          android:layout_alignWithParentIfMissing="true"
          android:layout_toRightOf="@id/icon1"
          android:gravity="center_vertical"
          android:text="Some Information" /&gt;
  
      &lt;ImageView
          android:id="@+id/icon2"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent"
          android:layout_alignParentRight="true"
          android:layout_alignParentTop="true"
          android:layout_marginRight="6dip"
          android:src="@drawable/ic_launcher" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class FirstLoginActivity extends ListActivity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          String[] testcontacts = getResources().getStringArray(
                  R.array.testcontacts_array);
          setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_items,
                  testcontacts));
  
          ListView lv = getListView();
          lv.setTextFilterEnabled(true);
  
          lv.setOnItemClickListener(new OnItemClickListener() {
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                      int position, long id) {
                  // When clicked, show a toast with the TextView text
                  Toast.makeText(getApplicationContext(),
                          ((TextView) view).getText(), Toast.LENGTH_SHORT).show();
              }
          });
      }
  </code></pre>
  
  <p>I am pretty sure I'm doing this right, I've been through numerous tutorials and I've found that the fastest and most efficient way is to create a static <code>ViewHolder</code> class.  One of the tutorials tried accessing the data directly which is what I was trying to do.  I'm still a little confused on how to do so.</p>
  
  <pre><code>    public class FirstLoginActivity extends ListActivity {
      Context mContext;
      List mList;
  
      String[] testcontacts = getResources().getStringArray(
              R.array.testcontacts_array);
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_items,
                  testcontacts));
  
          ListView lv = getListView();
          lv.setTextFilterEnabled(true);
  
          lv.setOnItemClickListener(new OnItemClickListener() {
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                      int position, long id) {
                  // When clicked, show a toast with the TextView text
                  Toast.makeText(getApplicationContext(),
                          ((TextView) view).getText(), Toast.LENGTH_SHORT).show();
              }
          });
      }
  
  
  
      public View getView(int position, View convertview, ViewGroup parent) {
          ViewHolder holder;
          View v = convertview;
          if (v == null) {
              LayoutInflater inflater = (LayoutInflater) LayoutInflater
                      .from(mContext);
              v = inflater.inflate(R.layout.list_items, null);
              holder = new ViewHolder();
              holder.firstLine = (TextView) v.findViewById(R.id.firstLine);
              holder.secondLine = (TextView) v.findViewById(R.id.secondLine);
              holder.icon1 = (ImageView) v.findViewById(R.id.icon1);
              holder.icon2 = (ImageView) v.findViewById(R.id.icon2);
              v.setTag(holder);
          } else {
              holder = (ViewHolder) v.getTag();
          }
          holder.firstLine.setText(testcontacts[position]);
          holder.secondLine.setText(testcontacts[position]);
          // holder.icon1.setImageBitmap((position &amp; 1) == 1 ? mIcon1: mIcon2);
          //call the images directly?
          return v;
      }
  
      static class ViewHolder {
          TextView firstLine;
          TextView secondLine;
          ImageView icon1;
          ImageView icon2;
  
      }
  }
  </code></pre>