# GestureDescription.StrokeDescription

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

# StrokeDescription

*** ** * ** ***

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

```
class StrokeDescription
```

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                                         ||
| ↳ | [android.accessibilityservice.GestureDescription.StrokeDescription](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#) |

Immutable description of stroke that can be part of a gesture.

## Summary

|                                                                                                                                                                                                                                                                                                           Public constructors                                                                                                                                                                                                                                                                                                           ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [StrokeDescription](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#StrokeDescription(android.graphics.Path,%20kotlin.Long,%20kotlin.Long))`(`path:` `[Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#)`, `startTime:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `duration:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` <br />                                                                                                                         |
| [StrokeDescription](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#StrokeDescription(android.graphics.Path,%20kotlin.Long,%20kotlin.Long,%20kotlin.Boolean))`(`path:` `[Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#)`, `startTime:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `duration:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `willContinue:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> |

|                                                                                                                                                                                                                                                                                                                                                                                                              Public methods                                                                                                                                                                                                                                                                                                                                                                                                               ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[GestureDescription.StrokeDescription](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#)! | [continueStroke](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#continueStroke(android.graphics.Path,%20kotlin.Long,%20kotlin.Long,%20kotlin.Boolean))`(`path:` `[Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#)!`, `startTime:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `duration:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `willContinue:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Create a new stroke that will continue this one. |
| open[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)                                                                               | [getDuration](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#getDuration())`()` Get the stroke's duration                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| open[Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#)!                                                                        | [getPath](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#getPath())`()` Retrieve a copy of the path for this stroke                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| open[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)                                                                               | [getStartTime](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#getStartTime())`()` Get the stroke's start time                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                         | [willContinue](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#willContinue())`()` Check if this stroke is marked to continue in the next gesture.                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

## Public constructors

### StrokeDescription

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

```
StrokeDescription(
    path: Path, 
    startTime: Long, 
    duration: Long)
```

|                                                                                                                                                                           Parameters                                                                                                                                                                            ||
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `path`      | [Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#):The path to follow. Must have exactly one contour. The bounds of the path must not be negative. The path must not be empty. If the path has zero length (for example, a single`moveTo()`), the stroke is a touch that doesn't move. This value cannot be`null`. |
| `startTime` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The time, in milliseconds, from the time the gesture starts to the time the stroke should start. Must not be negative. Value is 0 or greater                                                                                                                          |
| `duration`  | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The duration, in milliseconds, the stroke takes to traverse the path. Must be positive. Value is 0 or greater                                                                                                                                                         |

### StrokeDescription

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

```
StrokeDescription(
    path: Path, 
    startTime: Long, 
    duration: Long, 
    willContinue: Boolean)
```

|                                                                                                                                                                             Parameters                                                                                                                                                                             ||
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `path`         | [Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#):The path to follow. Must have exactly one contour. The bounds of the path must not be negative. The path must not be empty. If the path has zero length (for example, a single`moveTo()`), the stroke is a touch that doesn't move. This value cannot be`null`. |
| `startTime`    | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The time, in milliseconds, from the time the gesture starts to the time the stroke should start. Must not be negative. Value is 0 or greater                                                                                                                          |
| `duration`     | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The duration, in milliseconds, the stroke takes to traverse the path. Must be positive. Value is 0 or greater                                                                                                                                                         |
| `willContinue` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):`true`if this stroke will be continued by one in the next gesture`false`otherwise. Continued strokes keep their pointers down when the gesture completes.                                                                                                       |

## Public methods

### continueStroke

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

```
open fun continueStroke(
    path: Path!, 
    startTime: Long, 
    duration: Long, 
    willContinue: Boolean
): GestureDescription.StrokeDescription!
```

Create a new stroke that will continue this one. This is only possible if this stroke will continue.

|                                                                                                                                            Parameters                                                                                                                                             ||
|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `path`         | [Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#)!:The path for the stroke that continues this one. The starting point of this path must match the ending point of the stroke it continues.                                                      |
| `startTime`    | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The time, in milliseconds, from the time the gesture starts to the time this stroke should start. Must not be negative. This time is from the start of the new gesture, not the one being continued. |
| `duration`     | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):The duration for the new stroke. Must not be negative.                                                                                                                                               |
| `willContinue` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):`true`if this stroke will be continued by one in the next gesture`false`otherwise.                                                                                                             |

|                                                                            Return                                                                             ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [GestureDescription.StrokeDescription](https://developer.android.com/reference/kotlin/android/accessibilityservice/GestureDescription.StrokeDescription#)! |   |

### getDuration

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

```
open fun getDuration(): Long
```

Get the stroke's duration

|                                                   Return                                                   ||
|------------------------------------------------------------------------------|------------------------------|
| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | the duration for this stroke |

### getPath

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

```
open fun getPath(): Path!
```

Retrieve a copy of the path for this stroke

|                                                 Return                                                  ||
|-------------------------------------------------------------------------------------|--------------------|
| [Path](https://developer.android.com/reference/kotlin/android/graphics/Path.html#)! | A copy of the path |

### getStartTime

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

```
open fun getStartTime(): Long
```

Get the stroke's start time

|                                                    Return                                                     ||
|------------------------------------------------------------------------------|---------------------------------|
| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | the start time for this stroke. |

### willContinue

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

```
open fun willContinue(): Boolean
```

Check if this stroke is marked to continue in the next gesture.

|                                                           Return                                                            ||
|------------------------------------------------------------------------------------|-----------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if the stroke is to be continued. |