title: ArrrayAdapter requires resourceID to be a text view
body: <p>The goal of this project of mine is to update a spinner dynamically with user input. Unfortunately I'm losing this battle. Logcat keeps throwing the resource ID error at me, HOWEVER, I don't understand why it's only thrown on button press, wouldn't it be thrown after onCreate, if that's where the problem is? </p>
  
  <p>Eclipse (via ctrl + space) tells me the to specify the Resource ID of the layout CONTAINING the TextView. Which I also don't even understand why I would need a textview, if I'm just handling an array and a spinner. AndroidDevelopment site also says the same. I'm just confused.So, my question is, what does this error mean, and what am I doing wrong?</p>
  
  <p>I BELIEVE this is the line in question:</p>
  
  <pre><code>list = new ArrayAdapter&lt;String&gt;(this,R.layout.settings,items);
  </code></pre>
  
  <p>This is the .java</p>
  
  <pre><code>    package com.example.thepicker;
  
  import java.util.ArrayList;
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.EditText;
  import android.widget.ImageButton;
  import android.widget.Spinner;
  
  public class Settings extends Activity implements OnClickListener{
  
  
      EditText getit;
      ImageButton giveit;
      Spinner thelist;
      ArrayList&lt;String&gt; items;
      ArrayAdapter&lt;String&gt; list;
      String transit;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.settings);
  
          items = new ArrayList&lt;String&gt;();
          list = new ArrayAdapter&lt;String&gt;(this,R.layout.settings,items);
          getit = (EditText) findViewById(R.id.getit);
          giveit = (ImageButton) findViewById(R.id.giveit);
          thelist = (Spinner) findViewById(R.id.thelist);
  
  
          thelist.setAdapter(list);
          giveit.setOnClickListener(this);
      }
  
  @Override
      public void onClick(View v) {
          String transit = getit.getText().toString();
          items.add(transit);
          list.insert(transit, 0);
          list.notifyDataSetChanged();
      }
  }
  </code></pre>
  
  <p>This is the logcat</p>
  
  <pre><code>03-11 01:39:25.682: E/Trace(1722): error opening trace file: No such file or directory (2)
  03-11 01:39:26.452: D/libEGL(1722): loaded /system/lib/egl/libEGL_emulation.so
  03-11 01:39:26.532: D/(1722): HostConnection::get() New Host Connection established 0x556a6180, tid 1722
  03-11 01:39:26.602: D/libEGL(1722): loaded /system/lib/egl/libGLESv1_CM_emulation.so
  03-11 01:39:26.623: D/libEGL(1722): loaded /system/lib/egl/libGLESv2_emulation.so
  03-11 01:39:26.761: W/EGL_emulation(1722): eglSurfaceAttrib not implemented
  03-11 01:39:26.772: D/OpenGLRenderer(1722): Enabling debug mode 0
  03-11 01:39:30.483: W/EGL_emulation(1722): eglSurfaceAttrib not implemented
  03-11 01:39:36.412: E/ArrayAdapter(1722): You must supply a resource ID for a TextView
  03-11 01:39:36.412: D/AndroidRuntime(1722): Shutting down VM
  03-11 01:39:36.423: W/dalvikvm(1722): threadid=1: thread exiting with uncaught exception (group=0x2bd39930)
  03-11 01:39:36.562: E/AndroidRuntime(1722): FATAL EXCEPTION: main
  03-11 01:39:36.562: E/AndroidRuntime(1722): java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:386)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:193)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.Spinner.onMeasure(Spinner.java:439)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.View.measure(View.java:15513)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:645)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:425)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.View.measure(View.java:15513)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.View.measure(View.java:15513)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.View.measure(View.java:15513)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.View.measure(View.java:15513)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.Choreographer.doCallbacks(Choreographer.java:562)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.Choreographer.doFrame(Choreographer.java:532)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.os.Handler.handleCallback(Handler.java:725)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.os.Handler.dispatchMessage(Handler.java:92)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.os.Looper.loop(Looper.java:137)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.app.ActivityThread.main(ActivityThread.java:5039)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at java.lang.reflect.Method.invokeNative(Native Method)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at java.lang.reflect.Method.invoke(Method.java:511)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at dalvik.system.NativeStart.main(Native Method)
  03-11 01:39:36.562: E/AndroidRuntime(1722): Caused by: java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView
  03-11 01:39:36.562: E/AndroidRuntime(1722):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:379)
  03-11 01:39:36.562: E/AndroidRuntime(1722):     ... 35 more
  03-11 01:39:36.682: D/dalvikvm(1722): GC_CONCURRENT freed 188K, 4% free 6367K/6596K, paused 90ms+4ms, total 255ms
  03-11 01:39:40.702: I/Process(1722): Sending signal. PID: 1722 SIG: 9
  03-11 01:39:41.192: E/Trace(1747): error opening trace file: No such file or directory (2)
  03-11 01:39:41.992: D/libEGL(1747): loaded /system/lib/egl/libEGL_emulation.so
  03-11 01:39:42.092: D/(1747): HostConnection::get() New Host Connection established 0x556a6180, tid 1747
  03-11 01:39:42.376: D/libEGL(1747): loaded /system/lib/egl/libGLESv1_CM_emulation.so
  03-11 01:39:42.394: D/libEGL(1747): loaded /system/lib/egl/libGLESv2_emulation.so
  03-11 01:39:42.674: W/EGL_emulation(1747): eglSurfaceAttrib not implemented
  03-11 01:39:43.465: D/OpenGLRenderer(1747): Enabling debug mode 0
  </code></pre>