Code example for MotionEvent

Methods: getAction

    public void testTouchInterceptor() { 
      popupWindow.setTouchInterceptor(new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
          return event.getAction() == ACTION_DOWN;
      assertTrue(shadowOf(popupWindow).dispatchTouchEvent(obtain(1, 1, ACTION_DOWN, 1f, 1f, 0)));
  public static class WithContentView { 
    private WindowManager windowManager;
    private View contentView;
    private View anchor;
    private ShadowWindowManagerImpl shadowWindowManager;
Connect your IDE to all the code out there  Get Codota for Java