# GestureDetector.SimpleOnGestureListener

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

# SimpleOnGestureListener

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener "View this page in Java")  

```
open class SimpleOnGestureListener : GestureDetector.OnContextClickListener, GestureDetector.OnDoubleTapListener, GestureDetector.OnGestureListener
```

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

A convenience class to extend when you only want to listen for a subset of all the gestures. This implements all methods in the[OnGestureListener](https://developer.android.com/reference/kotlin/android/view/GestureDetector.OnGestureListener),[OnDoubleTapListener](https://developer.android.com/reference/kotlin/android/view/GestureDetector.OnDoubleTapListener), and[OnContextClickListener](https://developer.android.com/reference/kotlin/android/view/GestureDetector.OnContextClickListener)but does nothing and return`false`for all applicable methods.

## Summary

|                                                                          Public constructors                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [SimpleOnGestureListener](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#SimpleOnGestureListener())`()` <br /> |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ||
|----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onContextClick](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onContextClick(android.view.MotionEvent))`(`e:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`)` Notified when a context click occurs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onDoubleTap](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onDoubleTap(android.view.MotionEvent))`(`e:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`)` Notified when a double-tap occurs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onDoubleTapEvent](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onDoubleTapEvent(android.view.MotionEvent))`(`e:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`)` Notified when an event within a double-tap gesture occurs, including the down, move, and up events.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onDown](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onDown(android.view.MotionEvent))`(`e:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`)` Notified when a tap occurs with the down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)that triggered it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onFling](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onFling(android.view.MotionEvent,%20android.view.MotionEvent,%20kotlin.Float,%20kotlin.Float))`(`e1:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)?`, `e2:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`, `velocityX:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `velocityY:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Notified of a fling event when it occurs with the initial on down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)and the matching up[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent). |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [onLongPress](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onLongPress(android.view.MotionEvent))`(`e:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`)` Notified when a long press occurs with the initial on down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)that trigged it.                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onScroll](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onScroll(android.view.MotionEvent,%20android.view.MotionEvent,%20kotlin.Float,%20kotlin.Float))`(`e1:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)?`, `e2:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`, `distanceX:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `distanceY:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Notified when a scroll occurs with the initial on down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)and the current move[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent).         |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [onShowPress](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onShowPress(android.view.MotionEvent))`(`e:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`)` The user has performed a down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)and not performed a move or up yet.                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onSingleTapConfirmed](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onSingleTapConfirmed(android.view.MotionEvent))`(`e:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`)` Notified when a single-tap occurs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onSingleTapUp](https://developer.android.com/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener#onSingleTapUp(android.view.MotionEvent))`(`e:` `[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)`)` Notified when a tap occurs with the up[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)that triggered it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

## Public constructors

### SimpleOnGestureListener

```
SimpleOnGestureListener()
```

## Public methods

### onContextClick

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

```
open fun onContextClick(e: MotionEvent): Boolean
```

Notified when a context click occurs.

|                                                       Parameters                                                        ||
|-----|--------------------------------------------------------------------------------------------------------------------|
| `e` | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`. |

|                                                            Return                                                             ||
|------------------------------------------------------------------------------------|-------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the event is consumed, else false |

### onDoubleTap

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

```
open fun onDoubleTap(e: MotionEvent): Boolean
```

Notified when a double-tap occurs. Triggered on the down event of second tap.

|                                                       Parameters                                                        ||
|-----|--------------------------------------------------------------------------------------------------------------------|
| `e` | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`. |

|                                                            Return                                                             ||
|------------------------------------------------------------------------------------|-------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the event is consumed, else false |

### onDoubleTapEvent

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

```
open fun onDoubleTapEvent(e: MotionEvent): Boolean
```

Notified when an event within a double-tap gesture occurs, including the down, move, and up events.

|                                                       Parameters                                                        ||
|-----|--------------------------------------------------------------------------------------------------------------------|
| `e` | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`. |

|                                                            Return                                                             ||
|------------------------------------------------------------------------------------|-------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the event is consumed, else false |

### onDown

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

```
open fun onDown(e: MotionEvent): Boolean
```

Notified when a tap occurs with the down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)that triggered it. This will be triggered immediately for every down event. All other events should be preceded by this.

|                                                       Parameters                                                        ||
|-----|--------------------------------------------------------------------------------------------------------------------|
| `e` | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`. |

### onFling

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

```
open fun onFling(
    e1: MotionEvent?, 
    e2: MotionEvent, 
    velocityX: Float, 
    velocityY: Float
): Boolean
```

Notified of a fling event when it occurs with the initial on down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)and the matching up[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent). The calculated velocity is supplied along the x and y axis in pixels per second.

|                                                                               Parameters                                                                               ||
|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `e1`        | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)?:This value may be`null`.                                          |
| `e2`        | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`.                                        |
| `velocityX` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The velocity of this fling measured in pixels per second along the x axis. |
| `velocityY` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The velocity of this fling measured in pixels per second along the y axis. |

|                                                            Return                                                             ||
|------------------------------------------------------------------------------------|-------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the event is consumed, else false |

### onLongPress

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

```
open fun onLongPress(e: MotionEvent): Unit
```

Notified when a long press occurs with the initial on down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)that trigged it.

|                                                       Parameters                                                        ||
|-----|--------------------------------------------------------------------------------------------------------------------|
| `e` | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`. |

### onScroll

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

```
open fun onScroll(
    e1: MotionEvent?, 
    e2: MotionEvent, 
    distanceX: Float, 
    distanceY: Float
): Boolean
```

Notified when a scroll occurs with the initial on down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)and the current move[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent). The distance in x and y is also supplied for convenience.

|                                                                                                           Parameters                                                                                                           ||
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `e1`        | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)?:This value may be`null`.                                                                                                  |
| `e2`        | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`.                                                                                                |
| `distanceX` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The distance along the X axis that has been scrolled since the last call to onScroll. This is NOT the distance between`e1`and`e2`. |
| `distanceY` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):The distance along the Y axis that has been scrolled since the last call to onScroll. This is NOT the distance between`e1`and`e2`. |

|                                                            Return                                                             ||
|------------------------------------------------------------------------------------|-------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the event is consumed, else false |

### onShowPress

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

```
open fun onShowPress(e: MotionEvent): Unit
```

The user has performed a down[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)and not performed a move or up yet. This event is commonly used to provide visual feedback to the user to let them know that their action has been recognized i.e. highlight an element.

|                                                       Parameters                                                        ||
|-----|--------------------------------------------------------------------------------------------------------------------|
| `e` | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`. |

### onSingleTapConfirmed

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

```
open fun onSingleTapConfirmed(e: MotionEvent): Boolean
```

Notified when a single-tap occurs.

Unlike[OnGestureListener.onSingleTapUp(MotionEvent)](https://developer.android.com/reference/kotlin/android/view/GestureDetector.OnGestureListener#onSingleTapUp(android.view.MotionEvent)), this will only be called after the detector is confident that the user's first tap is not followed by a second tap leading to a double-tap gesture.

|                                                       Parameters                                                        ||
|-----|--------------------------------------------------------------------------------------------------------------------|
| `e` | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`. |

|                                                            Return                                                             ||
|------------------------------------------------------------------------------------|-------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the event is consumed, else false |

### onSingleTapUp

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

```
open fun onSingleTapUp(e: MotionEvent): Boolean
```

Notified when a tap occurs with the up[MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent)that triggered it.

|                                                       Parameters                                                        ||
|-----|--------------------------------------------------------------------------------------------------------------------|
| `e` | [MotionEvent](https://developer.android.com/reference/kotlin/android/view/MotionEvent):This value cannot be`null`. |

|                                                            Return                                                             ||
|------------------------------------------------------------------------------------|-------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the event is consumed, else false |