title: Rotation in ViewPager
body: <p>I have a fragment with ViewPager having WebViews. When i rotate the phone the ViewPager shows the first page. This is because the activity and the fragment is created again. How do i save the state of ViewPager. The following code does not work</p>
  
  <pre><code>@Override
  public void onActivityCreated(Bundle savedInstanceState) 
      {
          super.onActivityCreated(savedInstanceState);
          if (savedInstanceState != null) 
          {
              // Restore last state for checked position.
              int pos  = savedInstanceState.getInt("currentPosition");
              this.setSelectedItem(pos);
          }
      }
  
      @Override
      public void onSaveInstanceState(Bundle outState) 
      {
          super.onSaveInstanceState(outState);
          outState.putInt("currentPosition", positionOfSelectedIndex);
      }
  </code></pre>