title: How can you include a ViewPager inside a ListView header
body: <p>I want to be able to put a "image slider" in the header of a list view. So, the user can swipe through images, then when they start to scroll the page, the slider scrolls out of view.</p>
  
  <p>I have gotten my desired slider with a ViewPager. Now all, I need to do is insert it into the header of the List View, but this seems to be causing me major issues.</p>
  
  <p>I add the pager as such:</p>
  
  <pre><code>ViewPager pager = (ViewPager) inflater.inflate(R.layout.featured_event, listView, false);
  
  FeaturedEventAdapter featuredAdapter = new FeaturedEventAdapter( getFragmentManager() );
  
  pager.setAdapter( featuredAdapter );
  
  listView.addHeaderView( pager );
  </code></pre>
  
  <p>I receive the following error:</p>
  
  <pre><code>java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.support.v4.view.ViewPager
  </code></pre>
  
  <p>Now, a key thing to note, is that this works perfectly fine if I am displaying it outside of the List View.</p>
  
  <p>Edit: featured_event xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;    
  &lt;android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/pager"
     android:layout_width="match_parent"
     android:layout_height="200dip"&gt;
  
      &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:gravity="center_horizontal" &gt;
  
          &lt;ImageView xmlns:android="http://schemas.android.com/apk/res/android"
               android:id="@+id/imageView1"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:src="@drawable/car" /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/android.support.v4.view.ViewPager&gt;
  </code></pre>