Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/view/View.OnLongClickListener#pubmethods)

# View.OnLongClickListener

*** ** * ** ***

` public static interface View.OnLongClickListener `   
` `

|---|
| android.view.View.OnLongClickListener |

Known indirect subclasses [ZoomButton](https://developer.android.com/reference/android/widget/ZoomButton) [ZoomButton](https://developer.android.com/reference/android/widget/ZoomButton) *This class was deprecated in API level 26. Use other means to handle this functionality. This widget is merely a simple wrapper around a long-press handler.*   

*** ** * ** ***

Interface definition for a callback to be invoked when a view has been clicked and held.

## Summary

| ### Public methods ||
|---|---|
| ` abstract boolean` | ` https://developer.android.com/reference/android/view/View.OnLongClickListener#onLongClick(android.view.View)(https://developer.android.com/reference/android/view/View v) ` Called when a view has been clicked and held. |
| ` default boolean` | ` https://developer.android.com/reference/android/view/View.OnLongClickListener#onLongClickUseDefaultHapticFeedback(android.view.View)(https://developer.android.com/reference/android/view/View v) ` Returns whether the default `https://developer.android.com/reference/android/view/HapticFeedbackConstants#LONG_PRESS` haptic feedback is performed when this listener has consumed the long click. |

## Public methods

### onLongClick

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

```
public abstract boolean onLongClick (View v)
```

Called when a view has been clicked and held.

<br />

| Parameters ||
|---|---|
| `v` | `View`: The view that was clicked and held. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the callback consumed the long click, false otherwise. <br /> |

### onLongClickUseDefaultHapticFeedback

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

```
public boolean onLongClickUseDefaultHapticFeedback (View v)
```

Returns whether the default `https://developer.android.com/reference/android/view/HapticFeedbackConstants#LONG_PRESS` haptic feedback is performed when this listener has consumed the long click. This method is called immediately after `https://developer.android.com/reference/android/view/View.OnLongClickListener#onLongClick(android.view.View)` has returned true.

<br />

| Parameters ||
|---|---|
| `v` | `View`: The view that was clicked and held. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true to perform the default `https://developer.android.com/reference/android/view/HapticFeedbackConstants#LONG_PRESS` haptic feedback, or false if the handler manages all haptics itself. <br /> |