Share via


Activity.OnGenericMotionEvent(MotionEvent) Method

Definition

Called when a generic motion event was not handled by any of the views inside of the activity.

[Android.Runtime.Register("onGenericMotionEvent", "(Landroid/view/MotionEvent;)Z", "GetOnGenericMotionEvent_Landroid_view_MotionEvent_Handler")]
public virtual bool OnGenericMotionEvent (Android.Views.MotionEvent? e);
[<Android.Runtime.Register("onGenericMotionEvent", "(Landroid/view/MotionEvent;)Z", "GetOnGenericMotionEvent_Landroid_view_MotionEvent_Handler")>]
abstract member OnGenericMotionEvent : Android.Views.MotionEvent -> bool
override this.OnGenericMotionEvent : Android.Views.MotionEvent -> bool

Parameters

e
MotionEvent

The generic motion event being processed.

Returns

Return true if you have consumed the event, false if you haven't. The default implementation always returns false.

Attributes

Remarks

Called when a generic motion event was not handled by any of the views inside of the activity.

Generic motion events describe joystick movements, hover events from mouse or stylus devices, trackpad touches, scroll wheel movements and other motion events not handled by #onTouchEvent(MotionEvent) or #onTrackballEvent(MotionEvent). The MotionEvent#getSource() 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.

Generic motion events with source class android.view.InputDevice#SOURCE_CLASS_POINTER are delivered to the view under the pointer. All other generic motion events are delivered to the focused view.

See View#onGenericMotionEvent(MotionEvent) for an example of how to handle this event.

Java documentation for android.app.Activity.onGenericMotionEvent(android.view.MotionEvent).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to