title: ViewPager with dynamic contents
body: <p>I am using the method suggested <a href="http://thepseudocoder.wordpress.com/2011/10/13/android-tabs-viewpager-swipe-able-tabs-ftw/" rel="nofollow">here</a> in order to implement swipeable tabs in Android using the SupportV4 library. In order to initialise the ViewPager, one has to create a page adapter which needs to be filled with a list of fragments/tabs, each associated with an activity, as shown here:</p>
  
  <pre><code>/**
   * Initialise ViewPager
   */
  private void intialiseViewPager() {
      List&lt;Fragment&gt; fragments = new Vector&lt;Fragment&gt;();
      fragments.add(Fragment.instantiate(this, Tab1Fragment.class.getName()));
      fragments.add(Fragment.instantiate(this, Tab2Fragment.class.getName()));
      fragments.add(Fragment.instantiate(this, Tab3Fragment.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>
  
  <p>My question is: how can I dynamically populate the fragments list with tabs not associated with any class. For example a list of tabs in which the header of the tabs are obtained from an string array</p>