Added in API level 1

View.OnLongClickListener


public static interface View.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 onLongClick(View v)

Called when a view has been clicked and held.

default boolean onLongClickUseDefaultHapticFeedback(View v)

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
public abstract boolean onLongClick (View v)

Called when a view has been clicked and held.

Parameters
v View: The view that was clicked and held.

Returns
boolean true if the callback consumed the long click, false otherwise.

onLongClickUseDefaultHapticFeedback

Added in API level 34
public boolean onLongClickUseDefaultHapticFeedback (View v)

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(View) has returned true.

Parameters
v View: The view that was clicked and held. This value cannot be null.

Returns
boolean true to perform the default HapticFeedbackConstants.LONG_PRESS haptic feedback, or false if the handler manages all haptics itself.