How to add fragments to a pageViewer?
<p>I'm following some example code <a href="http://thepseudocoder.wordpress.com/2011/10/13/android-tabs-viewpager-swipe-able-tabs-ftw/" rel="nofollow">here</a>. I'm trying to understand the steps involved to instantiate a fragment and then add it to the ViewPager.</p>

<p>I think I understand that fragments.add() adds the fragment to the ViewPager. I'm not sure I understand what Fragment.instantiate() does. <a href="http://developer.android.com/reference/android/app/Fragment.html#instantiate%28android.content.Context,%20java.lang.String%29" rel="nofollow">Android docs</a> say that it needs a "context" for instantiating. What does that mean?</p>

<pre><code>private void setupViewPager() {

    List&lt;Fragment&gt; fragments = new Vector&lt;Fragment&gt;();
    fragments.add(Fragment.instantiate(this, FragmentTab1.class.getName()));
    fragments.add(Fragment.instantiate(this, FragmentTab2.class.getName()));
    fragments.add(Fragment.instantiate(this, FragmentTab3.class.getName()));

    this.mPagerAdapter  = new PagerAdapter(super.getSupportFragmentManager(), fragments);
    //
    this.mViewPager = (ViewPager)super.findViewById(R.id.viewpager);
    this.mViewPager.setAdapter(this.mPagerAdapter);
    this.mViewPager.setOnPageChangeListener(this);
}
</code></pre>
