Added in API level 3

HapticFeedbackConstants


open class HapticFeedbackConstants
kotlin.Any
   ↳ android.view.HapticFeedbackConstants

Constants to be used to perform haptic feedback effects via View.performHapticFeedback(int)

Summary

Constants
static Int

The user has pressed either an hour or minute tick of a Clock.

static Int

A haptic effect to signal the confirmation or successful completion of a user interaction.

static Int

The user has performed a context click on an object.

static Int

The user has started a drag-and-drop gesture.

static Int

Flag for View.performHapticFeedback(int, int): Ignore the global setting for whether to perform haptic feedback, do it always.

static Int

Flag for View.performHapticFeedback(int, int): Ignore the setting in the view for whether to perform haptic feedback, do it always.

static Int

The user has finished a gesture (e.g. on the soft keyboard).

static Int

The user has started a gesture (e.g. on the soft keyboard).

static Int

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is "eligible" at a certain threshold of movement, and can be cancelled by moving back past the threshold.

static Int

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is "eligible" at a certain threshold of movement, and can be cancelled by moving back past the threshold.

static Int

The user has pressed a virtual or software keyboard key.

static Int

The user has released a virtual keyboard key.

static Int

The user has pressed a soft keyboard key.

static Int

The user has performed a long press on an object that is resulting in an action being performed.

static Int

No haptic feedback should be performed.

static Int

A haptic effect to signal the rejection or failure of a user interaction.

static Int

The user is switching between a series of many potential choices, for example minutes on a clock face, or individual percentages.

static Int

The user is switching between a series of potential choices, for example items in a list or discrete points on a slider.

static Int

The user has performed a selection/insertion handle move on text field.

static Int

The user has toggled a switch or button into the off position.

static Int

The user has toggled a switch or button into the on position.

static Int

The user has pressed on a virtual on-screen key.

static Int

The user has released a virtual key.

Constants

CLOCK_TICK

Added in API level 21
static val CLOCK_TICK: Int

The user has pressed either an hour or minute tick of a Clock.

Value: 4

CONFIRM

Added in API level 30
static val CONFIRM: Int

A haptic effect to signal the confirmation or successful completion of a user interaction.

Value: 16

CONTEXT_CLICK

Added in API level 23
static val CONTEXT_CLICK: Int

The user has performed a context click on an object.

Value: 6

DRAG_START

Added in API level 34
static val DRAG_START: Int

The user has started a drag-and-drop gesture. The drag target has just been "picked up".

Value: 25

FLAG_IGNORE_GLOBAL_SETTING

Added in API level 3
Deprecated in API level 33
static val FLAG_IGNORE_GLOBAL_SETTING: Int

Deprecated: Starting from android.os.Build.VERSION_CODES#TIRAMISU only privileged apps can ignore user settings for touch feedback.

Flag for View.performHapticFeedback(int, int): Ignore the global setting for whether to perform haptic feedback, do it always.

Value: 2

FLAG_IGNORE_VIEW_SETTING

Added in API level 3
static val FLAG_IGNORE_VIEW_SETTING: Int

Flag for View.performHapticFeedback(int, int): Ignore the setting in the view for whether to perform haptic feedback, do it always.

Value: 1

GESTURE_END

Added in API level 30
static val GESTURE_END: Int

The user has finished a gesture (e.g. on the soft keyboard).

Value: 13

GESTURE_START

Added in API level 30
static val GESTURE_START: Int

The user has started a gesture (e.g. on the soft keyboard).

Value: 12

GESTURE_THRESHOLD_ACTIVATE

Added in API level 34
static val GESTURE_THRESHOLD_ACTIVATE: Int

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is "eligible" at a certain threshold of movement, and can be cancelled by moving back past the threshold. This constant indicates that the user's motion has just passed the threshold for the action to be activated on release.

Value: 23

GESTURE_THRESHOLD_DEACTIVATE

Added in API level 34
static val GESTURE_THRESHOLD_DEACTIVATE: Int

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is "eligible" at a certain threshold of movement, and can be cancelled by moving back past the threshold. This constant indicates that the user's motion has just re-crossed back "under" the threshold for the action to be activated, meaning the gesture is currently in a cancelled state.

Value: 24

KEYBOARD_PRESS

Added in API level 27
static val KEYBOARD_PRESS: Int

The user has pressed a virtual or software keyboard key.

Value: 3

KEYBOARD_RELEASE

Added in API level 27
static val KEYBOARD_RELEASE: Int

The user has released a virtual keyboard key.

Value: 7

KEYBOARD_TAP

Added in API level 8
static val KEYBOARD_TAP: Int

The user has pressed a soft keyboard key.

Value: 3

LONG_PRESS

Added in API level 3
static val LONG_PRESS: Int

The user has performed a long press on an object that is resulting in an action being performed.

Value: 0

NO_HAPTICS

Added in API level 34
static val NO_HAPTICS: Int

No haptic feedback should be performed. Applications may use this value to indicate skipping a call to android.view.View#performHapticFeedback entirely, or else rely that it will immediately return false.

Value: -1

REJECT

Added in API level 30
static val REJECT: Int

A haptic effect to signal the rejection or failure of a user interaction.

Value: 17

SEGMENT_FREQUENT_TICK

Added in API level 34
static val SEGMENT_FREQUENT_TICK: Int

The user is switching between a series of many potential choices, for example minutes on a clock face, or individual percentages. This constant is expected to be very soft, so as not to be uncomfortable when performed a lot in quick succession. If the device can’t make a suitably soft vibration, then it may not make any vibration.

Some specializations of this constant exist for specific actions, notably CLOCK_TICK and TEXT_HANDLE_MOVE.

See also SEGMENT_TICK.

Value: 27

SEGMENT_TICK

Added in API level 34
static val SEGMENT_TICK: Int

The user is switching between a series of potential choices, for example items in a list or discrete points on a slider.

See also SEGMENT_FREQUENT_TICK for cases where density of choices is high, and the haptics should be lighter or suppressed for a better user experience.

Value: 26

TEXT_HANDLE_MOVE

Added in API level 27
static val TEXT_HANDLE_MOVE: Int

The user has performed a selection/insertion handle move on text field.

Value: 9

TOGGLE_OFF

Added in API level 34
static val TOGGLE_OFF: Int

The user has toggled a switch or button into the off position.

Value: 22

TOGGLE_ON

Added in API level 34
static val TOGGLE_ON: Int

The user has toggled a switch or button into the on position.

Value: 21

VIRTUAL_KEY

Added in API level 5
static val VIRTUAL_KEY: Int

The user has pressed on a virtual on-screen key.

Value: 1

VIRTUAL_KEY_RELEASE

Added in API level 27
static val VIRTUAL_KEY_RELEASE: Int

The user has released a virtual key.

Value: 8