title: Non stop auto scroll of viewpager in android
body: <p>I have used timer to auto swipe the viewpager. But after reaching the last page the timer stops. How to make it to continue again from the first page? </p>
  
  <pre><code>final Handler mHandler = new Handler();
      final Runnable mUpdateResults = new Runnable() {
          public void run() {
              pager.setCurrentItem(page++);
  
          }
      };
  
      int delay = 1000; // delay for 1 sec.
  
      int period = 4000; // repeat every 4 sec.
  
      Timer timer = new Timer();
  
      timer.scheduleAtFixedRate(new TimerTask() {
  
      public void run() {
  
           mHandler.post(mUpdateResults);
  
      }
  
      }, delay, period);
  </code></pre>