Correct use of MotionEvent.ACTION_HOVER_EXIT?

1.6k views Asked by At

I would like to be notified when the pointer is out of the boundary of a View. So I set the listener like this :

view.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_HOVER_EXIT) {
               // Notify
            }
        } 

However, this doesn't work. Any ideas please? Many thanks!

1

There are 1 answers

0
igorshin On

According to documentation it should be delivered to

    View.onGenericMotionEvent(MotionEvent)

rather than

    View.onTouchEvent(MotionEvent)