Added in API level 1

OnLongClickListener


interface OnLongClickListener
android.view.View.OnLongClickListener

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

Summary

Public methods
abstract Boolean

Called when a view has been clicked and held.

open Boolean

Returns whether the default HapticFeedbackConstants#LONG_PRESS haptic feedback is performed when this listener has consumed the long click.

Public methods

onLongClick

Added in API level 1
abstract fun onLongClick(v: View!): Boolean

Called when a view has been clicked and held.

Parameters
v View!: The view that was clicked and held.
Return
Boolean true if the callback consumed the long click, false otherwise.

onLongClickUseDefaultHapticFeedback

Added in API level 34
open fun onLongClickUseDefaultHapticFeedback(v: View): Boolean

Returns whether the default HapticFeedbackConstants#LONG_PRESS haptic feedback is performed when this listener has consumed the long click. This method is called immediately after onLongClick has returned true.

Parameters
v View: The view that was clicked and held. This value cannot be null.
Return
Boolean true to perform the default HapticFeedbackConstants#LONG_PRESS haptic feedback, or false if the handler manages all haptics itself.