Nitesh Tiwari
Nitesh Tiwari

Reputation: 4762

call ACTION_UP after ACTION_MOVE

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

Upvotes: 2

Views: 1999

Answers (1)

GeorgeChen
GeorgeChen

Reputation: 333

It looks like similar issue to this

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

Upvotes: 1

Related Questions