title: Resume the ViewPager auto sliding while open an app
body: <p>Hi I am using ViewPager for auto swiping of 10 Text Quotes.When I open a app it starts from IMAGE1.Then it is keep on swiping upto the 10th quote.Let us consider,the viewpager showing 5th quote. Now I close it. When I open the app again it is starts from the first quote. But I need to show 6th Quote.</p>
  
  <p>How do I resume the quote from where I have left before.</p>
  
  <p><strong>Quote 1:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/GEiOI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GEiOI.png" alt="Quote1"></a></p>
  
  <p><strong>Quote 5:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/RxIL9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RxIL9.png" alt="enter image description here"></a></p>
  
  <p><strong>Quote 6:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/S7WhY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S7WhY.png" alt="enter image description here"></a></p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>int count=0;
  int pager_position;
      private void setTime_ToSlide() {
          TextSlideShowAdapter adapter = new TextSlideShowAdapter(MainActivity.this, title1, title2);
          myPager = (ViewPager) findViewById(R.id.reviewpager);
          myPager.setAdapter(adapter);
          myPager.setCurrentItem(0);
  
  
          Log.e("TEST", "Title Value Main " + title1 + " Title 2" + title2);
          timer = new Timer();
          timer.schedule(new TimerTask() {
              @Override
              public void run() {
                  runOnUiThread(new Runnable() {
                      @Override
                      public void run() {
                          if (count1 &lt;= 56) {
                              myPager.setCurrentItem(count1);
                              pager_position = myPager.getCurrentItem();
                              Log.e("Get current item", String.valueOf(myPager.getCurrentItem()));
                              count1++;
                          } else {
                              count1 = 0;
                              myPager.setCurrentItem(count1);
                          }
                      }
                  });
              }
          }, 500, 3000);
      }
  
  
      @Override
      protected void onPause() {
          super.onPause();
          saveCurrentPagePosition();
          Log.e("Get SharedPreference ", String.valueOf(pager_position));
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          //...
          setCurrentPagePosition();
      }
  
      private void setCurrentPagePosition() {
          myPager.setCurrentItem(pager_position);
      }
  
      private void saveCurrentPagePosition() {
          // store current page position in shared preference
          SharedPreferences.Editor editor = pref.edit();
          editor.putInt("PagerPosition", pager_position);
          editor.commit();
      }
  </code></pre>