- e
- The generic motion event being processed.
Documentation for this section has not yet been entered.
Implement this method to handle generic motion events.
java Example
public boolean onGenericMotionEvent(MotionEvent event) { if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK)) { if (event.getAction() == MotionEvent.ACTION_MOVE) { // process the joystick movement... return true; } } if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { 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); }
Generic motion events describe joystick movements, mouse hovers, track pad touches, scroll wheel movements and other input events. The MotionEvent.Source of the motion event specifies the class of input that was received. Implementations of this method must examine the bits in the source before processing the event. The following code example shows how this is done.
Generic motion events with source class InputDevice.SourceClassPointer are delivered to the view under the pointer. All other generic motion events are delivered to the focused view.