# GestureStroke

Added in[API level 4](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Fields](https://developer.android.com/reference/android/gesture/GestureStroke#lfields)\|[Ctors](https://developer.android.com/reference/android/gesture/GestureStroke#pubctors)\|[Methods](https://developer.android.com/reference/android/gesture/GestureStroke#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/gesture/GestureStroke#inhmethods)  

# GestureStroke

*** ** * ** ***

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

`
public


class
GestureStroke
`  
`

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


``


`

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

<br />

*** ** * ** ***

A gesture stroke started on a touch down and ended on a touch up. A stroke consists of a sequence of timed points. One or multiple strokes form a gesture.

## Summary

|                                                                                            ### Fields                                                                                            ||
|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
| ` public final `[RectF](https://developer.android.com/reference/android/graphics/RectF) | [boundingBox](https://developer.android.com/reference/android/gesture/GestureStroke#boundingBox) <br /> |
| ` public final float`                                                                   | [length](https://developer.android.com/reference/android/gesture/GestureStroke#length) <br />           |
| ` public final float[]`                                                                 | [points](https://developer.android.com/reference/android/gesture/GestureStroke#points) <br />           |

|                                                                                                                                                                                                  ### Public constructors                                                                                                                                                                                                  ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[GestureStroke](https://developer.android.com/reference/android/gesture/GestureStroke#GestureStroke(java.util.ArrayList<android.gesture.GesturePoint>))`(`[ArrayList](https://developer.android.com/reference/java/util/ArrayList)`<`[GesturePoint](https://developer.android.com/reference/android/gesture/GesturePoint)`> points) ` A constructor that constructs a gesture stroke from a list of gesture points. |

|                                                                                                                                                       ### Public methods                                                                                                                                                        ||
|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                                               | ` `[clearPath](https://developer.android.com/reference/android/gesture/GestureStroke#clearPath())`() ` Invalidates the cached path that is used to render the stroke.                                                    |
| ` `[Object](https://developer.android.com/reference/java/lang/Object)                                 | ` `[clone](https://developer.android.com/reference/android/gesture/GestureStroke#clone())`() ` Creates and returns a copy of this object.                                                                                |
| ` `[OrientedBoundingBox](https://developer.android.com/reference/android/gesture/OrientedBoundingBox) | ` `[computeOrientedBoundingBox](https://developer.android.com/reference/android/gesture/GestureStroke#computeOrientedBoundingBox())`() ` Computes an oriented bounding box of the stroke.                                |
| ` `[Path](https://developer.android.com/reference/android/graphics/Path)                              | ` `[getPath](https://developer.android.com/reference/android/gesture/GestureStroke#getPath())`() `                                                                                                                       |
| ` `[Path](https://developer.android.com/reference/android/graphics/Path)                              | ` `[toPath](https://developer.android.com/reference/android/gesture/GestureStroke#toPath(float,%20float,%20int))`(float width, float height, int numSample) ` Converts the stroke to a Path of a given number of points. |

| ### 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*.                                                                                             | ||

## Fields

### boundingBox

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

```
public final RectF boundingBox
```

<br />

<br />

### length

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

```
public final float length
```

<br />

<br />

### points

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

```
public final float[] points
```

<br />

<br />

## Public constructors

### GestureStroke

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

```
public GestureStroke (ArrayList<GesturePoint> points)
```

A constructor that constructs a gesture stroke from a list of gesture points.

<br />

## Public methods

### clearPath

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

```
public void clearPath ()
```

Invalidates the cached path that is used to render the stroke.

<br />

### clone

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

```
public Object clone ()
```

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object`x`, the expression:
>
> ```
>  x.clone() != x
> ```
will be true, and that the expression:
>
> ```
>  x.clone().getClass() == x.getClass()
> ```
will be`true`, but these are not absolute requirements. While it is typically the case that:
>
> ```
>  x.clone().equals(x)
> ```
will be`true`, this is not an absolute requirement.

By convention, the returned object should be obtained by calling`super.clone`. If a class and all of its superclasses (except`Object`) obey this convention, it will be the case that`x.clone().getClass() == x.getClass()`.

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by`super.clone`before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by`super.clone`need to be modified.

<br />

|                                               Returns                                                ||
|--------------------------------------------------------------------|----------------------------------|
| [Object](https://developer.android.com/reference/java/lang/Object) | a clone of this instance. <br /> |

### computeOrientedBoundingBox

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

```
public OrientedBoundingBox computeOrientedBoundingBox ()
```

Computes an oriented bounding box of the stroke.

<br />

|                                                            Returns                                                             ||
|----------------------------------------------------------------------------------------------------|----------------------------|
| [OrientedBoundingBox](https://developer.android.com/reference/android/gesture/OrientedBoundingBox) | OrientedBoundingBox <br /> |

### getPath

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

```
public Path getPath ()
```

<br />

<br />

|                                    Returns                                    ||
|-----------------------------------------------------------------------|--------|
| [Path](https://developer.android.com/reference/android/graphics/Path) | <br /> |

### toPath

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

```
public Path toPath (float width, 
                float height, 
                int numSample)
```

Converts the stroke to a Path of a given number of points.

<br />

|                                   Parameters                                   ||
|-------------|-------------------------------------------------------------------|
| `width`     | `float`: the width of the bounding box of the target path <br />  |
| `height`    | `float`: the height of the bounding box of the target path <br /> |
| `numSample` | `int`: the number of points needed <br />                         |

|                                        Returns                                         ||
|-----------------------------------------------------------------------|-----------------|
| [Path](https://developer.android.com/reference/android/graphics/Path) | the path <br /> |