title: app crashes when loading custom list layout
body: <p>I am trying to create a custom list layout.  Here is the method that does it:</p>
  
  <pre><code>private void setUpList() {
      String[] items = {"item 1" , "item 2", "item 3","item 4" , "item 5", "item 6"};
      ArrayAdapter arrayadp = new ArrayAdapter(this, R.layout.list_layout, items);
      setListAdapter(arrayadp);       
  }
  </code></pre>
  
  <p>and here is list_layout.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="match_parent"
  android:layout_height="match_parent"&gt;
  &lt;TextView android:layout_width="match_parent"
            android:layout_height="match_parent" 
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>If I change R.layout.list_layout to android.R.layout.simple_list_item_1 it works fine but I need to use a custom one.  How do i do this without having the app crash.</p>
  
  <p>Here is the crash log</p>
  
  <pre><code>10-06 17:59:55.488: ERROR/AndroidRuntime(6941): FATAL EXCEPTION: main
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.srose.forumapp/com.srose.forumapp.HotelsActivity}: java.lang.NullPointerException
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1815)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.app.ActivityThread.access$500(ActivityThread.java:122)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.os.Handler.dispatchMessage(Handler.java:99)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.os.Looper.loop(Looper.java:132)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.app.ActivityThread.main(ActivityThread.java:4123)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at java.lang.reflect.Method.invokeNative(Native Method)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at java.lang.reflect.Method.invoke(Method.java:491)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at dalvik.system.NativeStart.main(Native Method)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941): Caused by: java.lang.NullPointerException
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at com.srose.forumapp.HotelsActivity.setupListView(HotelsActivity.java:38)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at com.srose.forumapp.HotelsActivity.onCreate(HotelsActivity.java:29)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.app.Activity.performCreate(Activity.java:4397)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
  10-06 17:59:55.488: ERROR/AndroidRuntime(6941):     ... 11 more
  </code></pre>
  
  <p>new crash log</p>
  
  <pre><code>10-06 19:11:08.648: ERROR/ArrayAdapter(8552): You must supply a resource ID for a TextView
  10-06 19:11:08.648: DEBUG/AndroidRuntime(8552): Shutting down VM
  10-06 19:11:08.648: WARN/dalvikvm(8552): threadid=1: thread exiting with uncaught exception (group=0x40014760)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552): FATAL EXCEPTION: main
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552): java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:390)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.ArrayAdapter.getView(ArrayAdapter.java:366)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.AbsListView.obtainView(AbsListView.java:1970)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.ListView.measureHeightOfChildren(ListView.java:1228)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.ListView.onMeasure(ListView.java:1139)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.View.measure(View.java:10828)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:613)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:519)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.View.measure(View.java:10828)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:267)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.View.measure(View.java:10828)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1284)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:613)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:519)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.View.measure(View.java:10828)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4351)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:267)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:1889)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.View.measure(View.java:10828)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.ViewRoot.performTraversals(ViewRoot.java:938)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.view.ViewRoot.handleMessage(ViewRoot.java:2040)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.os.Handler.dispatchMessage(Handler.java:99)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.os.Looper.loop(Looper.java:132)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.app.ActivityThread.main(ActivityThread.java:4123)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at java.lang.reflect.Method.invokeNative(Native Method)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at java.lang.reflect.Method.invoke(Method.java:491)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at dalvik.system.NativeStart.main(Native Method)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552): Caused by: java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:383)
  10-06 19:11:08.678: ERROR/AndroidRuntime(8552):     ... 32 more
  </code></pre>