title: GetItem(int) to return Listfragment in FragmentPagerAdapter
body: <p>I am developing an Android app made up by 3 List fragments. I'm using a <code>ViewPager</code> object to make the user swipe between fragments. I have used the same code with fragments. But when I change it to use list fragments i'm getting an error </p>
  
  <pre><code>the return type is incompatible with FragmentPagerAdapter.getItem(int)
  </code></pre>
  
  <p>I'm stuck here for hours. please help..</p>
  
  <p>My Fragment Activity</p>
  
  <pre><code>public class PageViewActivity extends FragmentActivity {
  MyPageAdapter pageAdapter;
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_page_view);
  
      List&lt;ListFragment&gt; fragments = getFragments();
  
      pageAdapter = new MyPageAdapter(getSupportFragmentManager(), fragments);
  
      ViewPager pager = (ViewPager)findViewById(R.id.viewpager);
      pager.setAdapter(pageAdapter);
  
  }
  
  private List&lt;ListFragment&gt; getFragments(){
      List&lt;ListFragment&gt; fList = new ArrayList&lt;ListFragment&gt;();
  
      fList.add(AllMsgFragment.newInstance("Fragment 1"));
      fList.add(ErrorMsgFragment.newInstance("Fragment 2"));
      fList.add(SuccessMsgFragment.newInstance("Fragment 3"));
  
      return fList;
  }
  </code></pre>
  
  <p>and my FragmentPageAdapter</p>
  
  <pre><code>class MyPageAdapter extends FragmentPagerAdapter {
  private List&lt;ListFragment&gt; fragments;
  
  public MyPageAdapter(FragmentManager fm, List&lt;ListFragment&gt; fragments) {
      super(fm);
      this.fragments = fragments;
  }
  @Override
  public Fragment getItem(int position) {//The return type is incompatible with FragmentPagerAdapter.getItem(int)
      return this.fragments.get(position);
  }
  
  @Override
  public int getCount() {
      return this.fragments.size();
  }
  
  @Override
  public CharSequence getPageTitle(int position) {
      return "Page #" + ( position + 1 );
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks in advance</p>