title: Destroy Pages on ViewPager and FragmentStatePagerAdapter
body: <p>We are trying to create an Android application that is based on ViewPager that receive during runtime instructions to add and remove pages. Almost like a tabbed browser experience, that you can remove the current tab, or remove a specific tab.</p>
  
  <p>Following Google documentation we use FragmentStatePagerAdapter, that is intended to be used in situations when there are a large number of pages, working more like a list view.</p>
  
  <p>But when we try to:
  - Remove a page that is not on the screen
  - and create a new fragment object from the same class 
  - and on the same position of the page removed
  We noticed that the Android platform recover the dead page and display that to the user. The new object that we just created simply does not run “onCreate”, “onCreateView” or “onActivityCreated”.</p>
  
  <p>We are looking to ways to fix this issue forcing the platform to use our new fragment object from the same class. Any ideas?</p>
  
  <p>We found out that if we destroy the current page the platform indeed destroyed the page and created a new object from the same class. Here is a small example replicating the problem and this behavior.</p>
  
  <p>Source: <a href="http://dl.dropbox.com/u/8333012/SimpleAdapter/SimplePager.zip" rel="noreferrer">http://dl.dropbox.com/u/8333012/SimpleAdapter/SimplePager.zip</a></p>
  
  <p>Video: <a href="http://www.youtube.com/watch?v=-oaXXwU8PSI&amp;hd=1" rel="noreferrer">http://www.youtube.com/watch?v=-oaXXwU8PSI&amp;hd=1</a></p>
  
  <p>From this project when you touch the TextView on the first page it was designed to remove the second page (which is green) to a new blue page. You will see that even doing that from the first page the  second page remains green. But when you press the back Android button on the second page (green) and touch the TextView the second page created will be the right blue color.</p>