code: @Override
      public boolean dispatchTouchEvent(MotionEvent event) {
          switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                  x1 = event.getX();
                  y1 = event.getY();
  
                  break;
  
              case MotionEvent.ACTION_MOVE:
                  x2 = event.getX();
                  y2 = event.getY();
  
                  if (isScrollingHorizontal(x1, y1, x2, y2)) {
                      // When the user is scrolling the ViewPager horizontally,
                      // block the pickers from scrolling vertically.
                      return super.dispatchTouchEvent(event);
                  }
  
                  break;
          }
  
          // As long as the ViewPager isn't scrolling horizontally,
          // dispatch the event to the DatePicker or TimePicker,
          // depending on which page the ViewPager is currently on.
  
          switch (getCurrentItem()) {
              case 0:
  
                  if (mDatePicker != null)
                      mDatePicker.dispatchTouchEvent(event);
  
                  break;
  
              case 1:
  
                  if (mTimePicker != null)
                      mTimePicker.dispatchTouchEvent(event);
  
                  break;
          }
  
          // need this for the ViewPager to scroll horizontally at all
          return super.onTouchEvent(event);
      }
docs: When the user swipes their finger horizontally, dispatch
  those touch events to the ViewPager. When they swipe
  vertically, dispatch those touch events to the date or
  time picker (depending on which page we're currently on).
  
  @param event