title: How to change ViewPager's page?
body: <p>I'm using ViewPager in my app and define it in the main Activity. Inside <code>onCreate</code> method I load some number of pages from SharedPreferences and then pass it to PagerAdapter:</p>
  
  <pre><code>@Override
  public int getCount() {
      return numberOfPages;
  }
  </code></pre>
  
  <p>The problem is that if I would change this number in Preferences (or another Activity) to some other less then page index I viewed before, my app crashes because this index is out of bounds when I return to the activity with this ViewPager. It can be fixed simply by changing active ViewPager's page. Is there any way to do it?</p>