# GestureDetector.SimpleOnGestureListener

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener#pubctors)\|[Methods](https://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener#inhmethods)  

# GestureDetector.SimpleOnGestureListener

*** ** * ** ***

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

`
public
static


class
GestureDetector.SimpleOnGestureListener
`  
`

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


``


implements

`[GestureDetector.OnContextClickListener](https://developer.android.com/reference/android/view/GestureDetector.OnContextClickListener)`,

`[GestureDetector.OnDoubleTapListener](https://developer.android.com/reference/android/view/GestureDetector.OnDoubleTapListener)`,

`[GestureDetector.OnGestureListener](https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener)`


`

|---|------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.GestureDetector.SimpleOnGestureListener |

<br />

*** ** * ** ***

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/android/view/GestureDetector.OnGestureListener),[OnDoubleTapListener](https://developer.android.com/reference/android/view/GestureDetector.OnDoubleTapListener), and[OnContextClickListener](https://developer.android.com/reference/android/view/GestureDetector.OnContextClickListener)but does nothing and return`false`for all applicable methods.

## Summary

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

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

| ### 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*.                                                                                             | ||
| From interface` `[android.view.GestureDetector.OnContextClickListener](https://developer.android.com/reference/android/view/GestureDetector.OnContextClickListener)` ` |---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` `[onContextClick](https://developer.android.com/reference/android/view/GestureDetector.OnContextClickListener#onContextClick(android.view.MotionEvent))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e) ` Notified when a context click occurs. | ||
| From interface` `[android.view.GestureDetector.OnDoubleTapListener](https://developer.android.com/reference/android/view/GestureDetector.OnDoubleTapListener)` ` |---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` `[onDoubleTap](https://developer.android.com/reference/android/view/GestureDetector.OnDoubleTapListener#onDoubleTap(android.view.MotionEvent))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e) ` Notified when a double-tap occurs.                                                                            | | ` abstract boolean` | ` `[onDoubleTapEvent](https://developer.android.com/reference/android/view/GestureDetector.OnDoubleTapListener#onDoubleTapEvent(android.view.MotionEvent))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e) ` Notified when an event within a double-tap gesture occurs, including the down, move, and up events. | | ` abstract boolean` | ` `[onSingleTapConfirmed](https://developer.android.com/reference/android/view/GestureDetector.OnDoubleTapListener#onSingleTapConfirmed(android.view.MotionEvent))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e) ` Notified when a single-tap occurs.                                                          | ||
| From interface` `[android.view.GestureDetector.OnGestureListener](https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener)` ` |---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` `[onDown](https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener#onDown(android.view.MotionEvent))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e) ` Notified when a tap occurs with the down[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)that triggered it.                                                                                                                                                                                                                                                                                    | | ` abstract boolean` | ` `[onFling](https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener#onFling(android.view.MotionEvent,%20android.view.MotionEvent,%20float,%20float))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e1, `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e2, float velocityX, float velocityY) ` Notified of a fling event when it occurs with the initial on down[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)and the matching up[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent). | | ` abstract void`    | ` `[onLongPress](https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener#onLongPress(android.view.MotionEvent))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e) ` Notified when a long press occurs with the initial on down[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)that trigged it.                                                                                                                                                                                                                                                          | | ` abstract boolean` | ` `[onScroll](https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener#onScroll(android.view.MotionEvent,%20android.view.MotionEvent,%20float,%20float))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e1, `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e2, float distanceX, float distanceY) ` Notified when a scroll occurs with the initial on down[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)and the current move[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent).         | | ` abstract void`    | ` `[onShowPress](https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener#onShowPress(android.view.MotionEvent))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e) ` The user has performed a down[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)and not performed a move or up yet.                                                                                                                                                                                                                                                                    | | ` abstract boolean` | ` `[onSingleTapUp](https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener#onSingleTapUp(android.view.MotionEvent))`(`[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)` e) ` Notified when a tap occurs with the up[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)that triggered it.                                                                                                                                                                                                                                                                        | ||

## Public constructors

### SimpleOnGestureListener

```
public SimpleOnGestureListener ()
```

<br />

<br />

## Public methods

### onContextClick

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

```
public boolean onContextClick (MotionEvent e)
```

Notified when a context click occurs.

<br />

|                       Parameters                       ||
|-----|---------------------------------------------------|
| `e` | `MotionEvent`: This value cannot be`null`. <br /> |

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | true if the event is consumed, else false <br /> |

### onDoubleTap

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

```
public boolean onDoubleTap (MotionEvent e)
```

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

<br />

|                       Parameters                       ||
|-----|---------------------------------------------------|
| `e` | `MotionEvent`: This value cannot be`null`. <br /> |

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | true if the event is consumed, else false <br /> |

### onDoubleTapEvent

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

```
public boolean onDoubleTapEvent (MotionEvent e)
```

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

<br />

|                       Parameters                       ||
|-----|---------------------------------------------------|
| `e` | `MotionEvent`: This value cannot be`null`. <br /> |

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | true if the event is consumed, else false <br /> |

### onDown

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

```
public boolean onDown (MotionEvent e)
```

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

<br />

|                       Parameters                       ||
|-----|---------------------------------------------------|
| `e` | `MotionEvent`: This value cannot be`null`. <br /> |

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

### onFling

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

```
public boolean onFling (MotionEvent e1, 
                MotionEvent e2, 
                float velocityX, 
                float velocityY)
```

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

<br />

|                                               Parameters                                                ||
|-------------|--------------------------------------------------------------------------------------------|
| `e1`        | `MotionEvent`: This value may be`null`. <br />                                             |
| `e2`        | `MotionEvent`: This value cannot be`null`. <br />                                          |
| `velocityX` | `float`: The velocity of this fling measured in pixels per second along the x axis. <br /> |
| `velocityY` | `float`: The velocity of this fling measured in pixels per second along the y axis. <br /> |

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | true if the event is consumed, else false <br /> |

### onLongPress

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

```
public void onLongPress (MotionEvent e)
```

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

<br />

|                       Parameters                       ||
|-----|---------------------------------------------------|
| `e` | `MotionEvent`: This value cannot be`null`. <br /> |

### onScroll

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

```
public boolean onScroll (MotionEvent e1, 
                MotionEvent e2, 
                float distanceX, 
                float distanceY)
```

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

<br />

|                                                                           Parameters                                                                            ||
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| `e1`        | `MotionEvent`: This value may be`null`. <br />                                                                                                     |
| `e2`        | `MotionEvent`: This value cannot be`null`. <br />                                                                                                  |
| `distanceX` | `float`: 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`. <br /> |
| `distanceY` | `float`: 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`. <br /> |

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | true if the event is consumed, else false <br /> |

### onShowPress

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

```
public void onShowPress (MotionEvent e)
```

The user has performed a down[MotionEvent](https://developer.android.com/reference/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.

<br />

|                       Parameters                       ||
|-----|---------------------------------------------------|
| `e` | `MotionEvent`: This value cannot be`null`. <br /> |

### onSingleTapConfirmed

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

```
public boolean onSingleTapConfirmed (MotionEvent e)
```

Notified when a single-tap occurs.

Unlike[OnGestureListener.onSingleTapUp(MotionEvent)](https://developer.android.com/reference/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.

<br />

|                       Parameters                       ||
|-----|---------------------------------------------------|
| `e` | `MotionEvent`: This value cannot be`null`. <br /> |

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | true if the event is consumed, else false <br /> |

### onSingleTapUp

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

```
public boolean onSingleTapUp (MotionEvent e)
```

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

<br />

|                       Parameters                       ||
|-----|---------------------------------------------------|
| `e` | `MotionEvent`: This value cannot be`null`. <br /> |

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | true if the event is consumed, else false <br /> |