title: FragmentPagerAdapter instantiateItem working with Fragments?
body: <p>i try to get my FragmentPagerAdapter working, but the examples are a bit to easy for real life :</p>
  
  <pre><code>@Override
  public Object instantiateItem(final ViewGroup container, final int position)
  {
      final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
      int resId = 0;
      switch (position)
          {
          case 0:
              resId = R.layout.favorites_fragment;
              break;
          case 1:
              resId = R.layout.nearby_list_fragment;
              break;
          default:
              throw new IllegalArgumentException("Index cant be mapped to fragement:" + position);
          }
  
      final View view = inflater.inflate(resId, null);
  
      viewPager.addView(view, 0);
  
      return view;
  }
  </code></pre>
  
  <p>As i'm want to use Fragments im already confused my this method as all example i could find inflate a view instead of create fragment there. How to do this ? </p>
  
  <p>PS: Im using the ActionBarSherlock lib 4.1...</p>
  
  <p>Thanks,
  Jens</p>