`ArrayAdapter` not working in android 2.1
<p>i have written the following code in my application:</p>

<pre><code>headers = new ArrayAdapter&lt;String&gt;(context,R.layout.yearlistingheader);
</code></pre>

<p>where the <code>yearlistingheader.xml</code> file is as follows:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;TextView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/list_header_title"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:paddingTop="2dip"
  android:paddingBottom="2dip"
  android:paddingLeft="5dip"
  style="@style/compactview"
  android:textColor="#ffffff"
  android:background="@drawable/mothlistingsectionhead" /&gt;
</code></pre>

<p>when i try and run my program i get the following error:</p>

<pre><code>05-09 14:52:13.224: ERROR/AndroidRuntime(1032): android.content.res.Resources$NotFoundException: Resource ID #0x7f070045 type #0x12 is not valid
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.content.res.Resources.loadXmlResourceParser(Resources.java:1874)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.content.res.Resources.getLayout(Resources.java:731)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at com.helios.NauticDates.YearListAdapter.getView(YearListAdapter.java:240)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.AbsListView.obtainView(AbsListView.java:1315)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.ListView.onMeasure(ListView.java:1109)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.View.measure(View.java:8171)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.View.measure(View.java:8171)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.View.measure(View.java:8171)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.View.measure(View.java:8171)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.View.measure(View.java:8171)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.View.measure(View.java:8171)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.View.measure(View.java:8171)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.os.Looper.loop(Looper.java:123)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at android.app.ActivityThread.main(ActivityThread.java:4627)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at java.lang.reflect.Method.invokeNative(Native Method)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at java.lang.reflect.Method.invoke(Method.java:521)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-09 14:52:13.224: ERROR/AndroidRuntime(1032):     at    dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>i am not able to understand which resource is not available.
the code on line 238 is the call to getView of this arrayadapter.</p>

<p>Also when i use the default android layout, there seems to be no error. here is the code that gives no error:</p>

<pre><code>headers = new ArrayAdapter&lt;String&gt;(context,android.R.layout.simple_list_item_1);
</code></pre>

<p>what is going wrong here?
thank you in advance.</p>
