title: Can't achieve notifyDataSetChanged()
body: <p>I'm using a <code>FragmentStatePagerAdapter</code> in order to achieve a <code>VerticalPageAdapter</code> purpose, I have to create a dynamic number of the same Fragment regarding to which <code>Button</code> is pressed, So, I retrieve only the specified fragment in the <code>getItem()</code> method :</p>
  
  <pre><code>public Fragment getItem(int i) {            
    return new Center_ver();        
  }
  </code></pre>
  
  <p>And the <code>getCount()</code> returns a dynamic number regarding to the pressed <code>Button</code> in other fragment:</p>
  
  <pre><code>@Override
  public int getCount() {         
      return num_of_gangs;    
  }
  </code></pre>
  
  <p>But that gave me <code>IlligalStateException</code> as I'm not called <code>notifyDataSetChanged()</code>, So, I added the notification to the method that I'm using to raising the number of Fragments:</p>
  
  <pre><code>public void add_gang() {    
      num_of_gangs ++;
      notifyDataSetChanged();     
  }
  </code></pre>
  
  <p>but I also got the <code>IlligalStateException</code> :</p>
  
  <pre><code>05-04 13:43:43.210: E/AndroidRuntime(1625): FATAL EXCEPTION: main
  05-04 13:43:43.210: E/AndroidRuntime(1625): java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 1, found: 5 Pager id: com.automation.isolace:id/lighting_vertical_pager Pager class: class com.automation.standards.VerticalViewPager Problematic adapter: class com.automation.pageadapters.LightVerticalPageAdapter
  </code></pre>
  
  <p>So, I decided to add it in the getCount() method before returning the Value as follows:</p>
  
  <pre><code>@Override
  public int getCount() {     
      notifyDataSetChanged();
      return num_of_gangs ;    
  }
  </code></pre>
  
  <p>but that gave me a <code>StackOverflowError</code> :</p>
  
  <pre><code>05-04 13:46:36.326: E/AndroidRuntime(1690): FATAL EXCEPTION: main
  05-04 13:46:36.326: E/AndroidRuntime(1690): java.lang.StackOverflowError
  05-04 13:46:36.326: E/AndroidRuntime(1690):     at com.automation.standards.VerticalViewPager$PagerObserver.onChanged(VerticalViewPager.java:2717)
  05-04 13:46:36.326: E/AndroidRuntime(1690):     at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
  05-04 13:46:36.326: E/AndroidRuntime(1690):     at android.support.v4.view.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:276)
  </code></pre>