title: SectionedAdapter (inflate layout)
body: <p>I have a <b>LinearLayout</b> which I wanna inflate into my <b>SectionedAdapter as a Header</b>. LinearLayout have one ImageView and one TextView. I tried this but it's not working...</p>
  
  <pre><code>SectionedAdapter adapter = new SectionedAdapter() {
   protected View getHeaderView(String caption, int index, View convertView, ViewGroup parent) {
   TextView result=(TextView)convertView;
  
  if (convertView == null) {
  result = (TextView) getLayoutInflater().inflate(R.layout.my_main_layout, null).findViewById(R.id.label);
  }
  result.setText(caption);
  
  return(result);
   }
  };
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>01-09 21:23:02.336: ERROR/AndroidRuntime(308): FATAL EXCEPTION: main
  01-09 21:23:02.336: ERROR/AndroidRuntime(308): java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.ListView.setupChild(ListView.java:1761)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.ListView.makeAndAddView(ListView.java:1730)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.ListView.fillDown(ListView.java:652)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.ListView.fillFromTop(ListView.java:709)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.ListView.layoutChildren(ListView.java:1580)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.AbsListView.onLayout(AbsListView.java:1147)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.view.View.layout(View.java:7035)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.view.View.layout(View.java:7035)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.view.View.layout(View.java:7035)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.view.View.layout(View.java:7035)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1042)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.view.View.layout(View.java:7035)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.view.View.layout(View.java:7035)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.view.View.layout(View.java:7035)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1045)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.os.Handler.dispatchMessage(Handler.java:99)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.os.Looper.loop(Looper.java:123)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at android.app.ActivityThread.main(ActivityThread.java:4627)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at java.lang.reflect.Method.invokeNative(Native Method)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at java.lang.reflect.Method.invoke(Method.java:521)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  01-09 21:23:02.336: ERROR/AndroidRuntime(308):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Ofcourse, casting (TextView) is a problem..?</p>