public static interface View.OnLongClickListener

android.view.View.OnLongClickListener

Known indirect subclasses

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 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

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

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.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-02-13 UTC.