2

How to call MotionEvent.ACTION_UP after MotionEvent.ACTION_MOVE into setOnTouchListener of the Button

Below is Small Snippets...

slide_button_start.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {


                switch (event.getAction()) {

                case MotionEvent.ACTION_MOVE:

                    if(!rect.contains(v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())){

                        logIt("OUtSide");
                        v.clearFocus();
                        viewPager.bringToFront();

                        return true;

                    }
                    return false;

                case MotionEvent.ACTION_DOWN:


                    logIt("Touch...Down");

                    rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());

                    return true;

                case MotionEvent.ACTION_UP:

                    logIt("UP ha called");
                    return true;

                }

                return false;
            }
        });

Any Answer Appreciated....Thks

Nitesh Tiwari
  • 4,742
  • 3
  • 28
  • 46

1 Answers1

1

It looks like similar issue to this

the listener has consumed the event. So ACTION_UP won't be called anymore.

Community
  • 1
  • 1
GeorgeChen
  • 333
  • 3
  • 9