title: How to get current swipe direction in action in ViewPager
body: <p>I am trying to use ViewPager for showing different views.</p>
  
  <p>Below is code I am using to check whether swiping is left or right </p>
  
  <pre><code>    myPager.setOnTouchListener(new ViewPager.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              float x = event.getX();
  
              switch(event.getAction()){
              case MotionEvent.ACTION_DOWN:
                  mStartDragX = x;
                  break;
              case MotionEvent.ACTION_MOVE:
                  if (event.getX() &gt; mStartDragX ) {
                      Log.i(TAG,"SWIPING RIGHT");
                  } else if (event.getX() &lt; mStartDragX) {
                      Log.i(TAG,"SWIPING LEFT");
                  }
                  break;
              }
              return false;
          }
      });
  </code></pre>
  
  <p>So when I start to swipe from right to left or right to left its showing me correct log message.</p>
  
  <p>But if I started to swipe from right to left and at the same time again if start to swipe from left to right, how can I identify whether currently swiping in which direction?</p>
  
  <p>Can anyone please help ?</p>
  
  <p>Thanks</p>