Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Fields](https://developer.android.com/reference/com/google/wear/input/GestureEvent#lfields) \| [Ctors](https://developer.android.com/reference/com/google/wear/input/GestureEvent#pubctors) \| [Methods](https://developer.android.com/reference/com/google/wear/input/GestureEvent#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/com/google/wear/input/GestureEvent#inhmethods)

# GestureEvent


`
public

final

class
GestureEvent
`


`

extends Object


`

`


`

|---|---|
| java.lang.Object ||
| ↳ | com.google.wear.input.GestureEvent |

<br />

*** ** * ** ***

Object used to report gesture input events.

A gesture input refers to an input where the user is not directly providing input on an `https://developer.android.com/reference/android/view/InputDevice` (like pressing a button or touching a screen). Instead, the user
performs a certain kind of gesture without directly using an input device (example: one handed
gestures using the hand on which the watch is worn) to provide input to the device.

A GestureEvent contains two important information, in addition to the time when the event
happened:

- **Action:** : represents the abstract action/motive that is being executed by the GestureEvent. It is intended to convey the intent of the user. Applications should primarily use the action of a GestureEvent when deciding how to process the event. For instance, a GestureEvent with an action of `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` should be used to perform some form of a dismiss operation, regardless of the raw gesture that produced the GestureEvent.
- **Gesture:** : represents the raw gesture/motion behind the GestureEvent. It shows the actual (physical) action (example, pinching). Given that different devices may use different gestures for a given gesture action, applications should **not** primarily rely on the gesture when deciding what to do in response to the event. Instead, the action should primarily drive the decision of how to handle the event. The gesture data may be used to instruct users on how to perform a gesture action.

<br />

## Summary

| ### Fields ||
|---|---|
| ` public static final int` | `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` The dismiss gesture action. |
| ` public static final int` | `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` The primary gesture action. |
| ` public static final int` | `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_DOUBLE_PINCH` A double pinch gesture: when a user performs quick back-to-back pinches. |
| ` public static final int` | `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_UNKNOWN` Unknown gesture. |
| ` public static final int` | `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_WRIST_TURN` A wrist turn gesture: when a user turns the watch-wearing wrist (example: user turns the wrist outside and back inside). |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/com/google/wear/input/GestureEvent#GestureEvent(long,%20int,%20int)(long eventTimeMillis, int action, int gesture) ` Creates an instance of a GestureEvent. |

| ### Public methods ||
|---|---|
| ` static String` | ` https://developer.android.com/reference/com/google/wear/input/GestureEvent#actionToString(int)(int action) ` Returns a String representing a given gesture `action`, for logging and debugging. |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/input/GestureEvent#equals(java.lang.Object)(Object o) ` |
| ` static String` | ` https://developer.android.com/reference/com/google/wear/input/GestureEvent#gestureToString(int)(int gesture) ` Returns a String representing a given `gesture`, for logging and debugging. |
| ` int` | ` https://developer.android.com/reference/com/google/wear/input/GestureEvent#getAction()() ` Retrieves the action for this event. |
| ` long` | ` https://developer.android.com/reference/com/google/wear/input/GestureEvent#getEventTime()() ` Retrieves the time this event occurred, in the `https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()` time base. |
| ` int` | ` https://developer.android.com/reference/com/google/wear/input/GestureEvent#getGesture()() ` Retrieves the raw gesture for this event. |
| ` int` | ` https://developer.android.com/reference/com/google/wear/input/GestureEvent#hashCode()() ` |
| ` String` | ` https://developer.android.com/reference/com/google/wear/input/GestureEvent#toString()() ` |

| ### Inherited methods |
|---|---|
| From class ` java.lang.Object ` |---|---| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class<?>` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||

## Fields

### ACTION_DISMISS

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int ACTION_DISMISS
```

The dismiss gesture action.

The action should be used to perform the dismiss action in context of the user experience.
Some examples include closing a dialog, silencing or dismissing an alarm, or undoing some
action.

The specific application of this action should be decided by the client of the API, in a
way that its users can easily get accustomed to.

<br />

### ACTION_PRIMARY

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int ACTION_PRIMARY
```

The primary gesture action.

The action should be used to perform the primary action in the context of the user
experience. Some examples include answering an incoming phone call, clicking the "Send"
button in a messaging application, or choosing the first (or obvious) option among a list of
options.

The specific application of this action should be decided by the client of the API, in a
way that its users can easily get accustomed to.

<br />

### GESTURE_DOUBLE_PINCH

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int GESTURE_DOUBLE_PINCH
```

A double pinch gesture: when a user performs quick back-to-back pinches.

<br />

### GESTURE_UNKNOWN

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int GESTURE_UNKNOWN
```

Unknown gesture.

This value may be used in cases where the type of gesture that produced a `https://developer.android.com/reference/com/google/wear/input/GestureEvent` is not known. It could also be used by APIs like `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getGestureForAction()`, as a return value for calls with an invalid
action (for example, GESTURE_UNKNOWN will be returned from `https://developer.android.com/reference/com/google/wear/input/GestureInputManager#getGestureForAction()` if the provided action constant is not valid or
supported by the device).

<br />

### GESTURE_WRIST_TURN

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int GESTURE_WRIST_TURN
```

A wrist turn gesture: when a user turns the watch-wearing wrist (example: user turns the
wrist outside and back inside).

<br />

## Public constructors

### GestureEvent

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public GestureEvent (long eventTimeMillis, 
                int action, 
                int gesture)
```

Creates an instance of a GestureEvent.

<br />

| Parameters ||
|---|---|
| `eventTimeMillis` | `long`: the time to be reported in `https://developer.android.com/reference/com/google/wear/input/GestureEvent#getEventTime()`, which should be the time the event occurred, in the `https://developer.android.com/reference/android/os/SystemClock#uptimeMillis()` time. <br /> |
| `action` | `int`: the gesture action for the event, to be reported in `https://developer.android.com/reference/com/google/wear/input/GestureEvent#getAction()`. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |
| `gesture` | `int`: the gesture for the event, to be reported in `https://developer.android.com/reference/com/google/wear/input/GestureEvent#getGesture()`. Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_UNKNOWN` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_DOUBLE_PINCH` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_WRIST_TURN` |

| Returns ||
|---|---|
|   | a GestureEvent instance with the provided parameters. <br /> |

## Public methods

### actionToString

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static String actionToString (int action)
```

Returns a String representing a given gesture `action`, for logging and debugging.

<br />

| Parameters ||
|---|---|
| `action` | `int`: Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

| Returns ||
|---|---|
| `String` | <br /> |

### equals

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean equals (Object o)
```

<br />

<br />

| Parameters ||
|---|---|
| `o` | `Object` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### gestureToString

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static String gestureToString (int gesture)
```

Returns a String representing a given `gesture`, for logging and debugging.

<br />

| Parameters ||
|---|---|
| `gesture` | `int`: Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_UNKNOWN` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_DOUBLE_PINCH` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_WRIST_TURN` |

| Returns ||
|---|---|
| `String` | <br /> |

### getAction

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int getAction ()
```

Retrieves the action for this event.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_PRIMARY` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#ACTION_DISMISS` |

### getEventTime

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public long getEventTime ()
```

Retrieves the time this event occurred, in the `https://developer.android.com/reference/android/os/SystemClock#uptimeMillis())</a></code> time base.</p></p>
<table class=`
`https://developer.android.com/reference/android/os/SystemClock#uptimeMillis())</a></code> time base.</p></p>
<table class=`````https://developer.android.com/reference/android/os/SystemClock#uptimeMillis())</a></code> time base.</p></p>
<table class=https://developer.android.com/reference/android/os/SystemClock#uptimeMillis())</a></code> time base.</p></p>
<table class=https://developer.android.com/reference/android/os/SystemClock#uptimeMillis())</a></code> time base.</p></p>
<table class=https://developer.android.com/reference/android/os/SystemClock#uptimeMillis())</a></code> time base.</p></p>
<table class=https://developer.android.com/topic/libraries/support-library/revisions


```
public int getGesture ()
```


Retrieves the raw gesture for this event.

<br />


| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_UNKNOWN` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_DOUBLE_PINCH` - `https://developer.android.com/reference/com/google/wear/input/GestureEvent#GESTURE_WRIST_TURN` |


### hashCode


Added in https://developer.android.com/topic/libraries/support-library/revisions


```
public int hashCode ()
```


<br />


<br />


| Returns ||
|---|---|
| `int` | <br /> |


### toString


Added in https://developer.android.com/topic/libraries/support-library/revisions


```
public String toString ()
```


<br />


<br />


| Returns ||
|---|---|
| `String` | <br /> |


`````


``


`