2012/03/01

onGenericMotionEvent


public boolean onGenericMotionEvent(MotionEvent event) {
     if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
         if (event.getAction() == MotionEvent.ACTION_MOVE) {
             // process the joystick movement...
             return true;
         }
     }
     if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
         switch (event.getAction()) {
             case MotionEvent.ACTION_HOVER_MOVE:
                 // process the mouse hover movement...
                 return true;
             case MotionEvent.ACTION_SCROLL:
                 // process the scroll wheel movement...
                 return true;
         }
     }
     return super.onGenericMotionEvent(event);
 }

No comments:

Post a Comment