# GestureDescription

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/accessibilityservice/GestureDescription#nestedclasses)\|[Methods](https://developer.android.com/reference/android/accessibilityservice/GestureDescription#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/accessibilityservice/GestureDescription#inhmethods)  

# GestureDescription

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription "View this page in Kotlin")\|Java

`
public

final

class
GestureDescription
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.accessibilityservice.GestureDescription |

<br />

*** ** * ** ***

Accessibility services with the[R.styleable.AccessibilityService_canPerformGestures](https://developer.android.com/reference/android/R.styleable#AccessibilityService_canPerformGestures)property can dispatch gestures. This class describes those gestures. Gestures are made up of one or more strokes. Gestures are immutable once built and will be dispatched to the specified display.

Spatial dimensions throughout are in screen pixels. Time is measured in milliseconds.

## Summary

|                                                                                                     ### Nested classes                                                                                                     ||
|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [GestureDescription.Builder](https://developer.android.com/reference/android/accessibilityservice/GestureDescription.Builder) Builder for a`GestureDescription`                                                  |
| ` class` | [GestureDescription.StrokeDescription](https://developer.android.com/reference/android/accessibilityservice/GestureDescription.StrokeDescription) Immutable description of stroke that can be part of a gesture. |

|                                                                                                                                                                                                                                     ### Public methods                                                                                                                                                                                                                                     ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                                                                                               | ` `[getDisplayId](https://developer.android.com/reference/android/accessibilityservice/GestureDescription#getDisplayId())`() ` Returns the ID of the display this gesture is sent on, for use with[DisplayManager.getDisplay(int)](https://developer.android.com/reference/android/hardware/display/DisplayManager#getDisplay(int)). |
| ` static long`                                                                                                                                       | ` `[getMaxGestureDuration](https://developer.android.com/reference/android/accessibilityservice/GestureDescription#getMaxGestureDuration())`() ` Get the upper limit on a gesture's duration.                                                                                                                                        |
| ` static int`                                                                                                                                        | ` `[getMaxStrokeCount](https://developer.android.com/reference/android/accessibilityservice/GestureDescription#getMaxStrokeCount())`() ` Get the upper limit for the number of strokes a gesture may contain.                                                                                                                        |
| ` `[GestureDescription.StrokeDescription](https://developer.android.com/reference/android/accessibilityservice/GestureDescription.StrokeDescription) | ` `[getStroke](https://developer.android.com/reference/android/accessibilityservice/GestureDescription#getStroke(int))`(int index) ` Read a stroke from the gesture                                                                                                                                                                  |
| ` int`                                                                                                                                               | ` `[getStrokeCount](https://developer.android.com/reference/android/accessibilityservice/GestureDescription#getStrokeCount())`() ` Get the number of stroke in the gesture.                                                                                                                                                          |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public methods

### getDisplayId

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getDisplayId ()
```

Returns the ID of the display this gesture is sent on, for use with[DisplayManager.getDisplay(int)](https://developer.android.com/reference/android/hardware/display/DisplayManager#getDisplay(int)).

<br />

|                Returns                ||
|-------|--------------------------------|
| `int` | The logical display id. <br /> |

### getMaxGestureDuration

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static long getMaxGestureDuration ()
```

Get the upper limit on a gesture's duration.

<br />

|                       Returns                        ||
|--------|----------------------------------------------|
| `long` | The maximum duration in milliseconds. <br /> |

### getMaxStrokeCount

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static int getMaxStrokeCount ()
```

Get the upper limit for the number of strokes a gesture may contain.

<br />

|                   Returns                    ||
|-------|---------------------------------------|
| `int` | The maximum number of strokes. <br /> |

### getStroke

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public GestureDescription.StrokeDescription getStroke (int index)
```

Read a stroke from the gesture

<br />

|                              Parameters                              ||
|---------|-------------------------------------------------------------|
| `index` | `int`: the index of the stroke Value is 0 or greater <br /> |

|                                                                                        Returns                                                                                         ||
|---------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| [GestureDescription.StrokeDescription](https://developer.android.com/reference/android/accessibilityservice/GestureDescription.StrokeDescription) | A description of the stroke. <br /> |

### getStrokeCount

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getStrokeCount ()
```

Get the number of stroke in the gesture.

<br />

|                       Returns                       ||
|-------|----------------------------------------------|
| `int` | the number of strokes in this gesture <br /> |