Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Ctors](https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder#inhmethods)

# HapticFeedbackRequest.Builder

*** ** * ** ***


`
public
static
final

class
HapticFeedbackRequest.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.os.vibrator.HapticFeedbackRequest.Builder |

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder#Builder(android.os.vibrator.HapticFeedbackRequest)(https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest request) ` Constructs a builder that is already populated with the fields from a given `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest`. |
| ` https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder#Builder(int)(int constant) ` Constructs a new builder for `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest`. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest` | ` https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder#build()() ` Builds a new `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest` from this builder object. |
| ` https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder` | ` https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder#setFlags(int)(int flags) ` Sets the `https://developer.android.com/reference/android/view/HapticFeedbackConstants` flags for the haptic feedback request. |
| ` https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder` | ` https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder#setUsage(int)(int usage) ` Sets the `https://developer.android.com/reference/android/os/VibrationAttributes` usage for the haptic feedback request. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public constructors

### Builder

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public Builder (HapticFeedbackRequest request)
```

Constructs a builder that is already populated with the fields from a given
`https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest`.

<br />

| Parameters ||
|---|---|
| `request` | `HapticFeedbackRequest`: the request to create a new builder from. This value cannot be `null`. <br /> |

### Builder

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public Builder (int constant)
```

Constructs a new builder for `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest`.

<br />

| Parameters ||
|---|---|
| `constant` | `int`: the haptic feedback constant for `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest` that will be constructed from the builder. This needs to be one of the constants defined in `https://developer.android.com/reference/android/view/HapticFeedbackConstants`. Value is one of the following: - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#NO_HAPTICS` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#LONG_PRESS` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#VIRTUAL_KEY` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#KEYBOARD_TAP` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#CLOCK_TICK` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#CONTEXT_CLICK` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#KEYBOARD_RELEASE` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#VIRTUAL_KEY_RELEASE` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#TEXT_HANDLE_MOVE` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#GESTURE_START` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#GESTURE_END` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#CONFIRM` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#REJECT` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#TOGGLE_ON` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#TOGGLE_OFF` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#GESTURE_THRESHOLD_ACTIVATE` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#GESTURE_THRESHOLD_DEACTIVATE` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#DRAG_START` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#SEGMENT_TICK` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#SEGMENT_FREQUENT_TICK` |

## Public methods

### build

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public HapticFeedbackRequest build ()
```

Builds a new `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest` from this builder object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest` | This value cannot be `null`. <br /> |

### setFlags

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public HapticFeedbackRequest.Builder setFlags (int flags)
```

Sets the `https://developer.android.com/reference/android/view/HapticFeedbackConstants` flags for the haptic feedback request.

<br />

| Parameters ||
|---|---|
| `flags` | `int`: Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#FLAG_IGNORE_VIEW_SETTING` - `https://developer.android.com/reference/android/view/HapticFeedbackConstants#FLAG_IGNORE_GLOBAL_SETTING` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder` | This value cannot be `null`. <br /> |

### setUsage

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public HapticFeedbackRequest.Builder setUsage (int usage)
```

Sets the `https://developer.android.com/reference/android/os/VibrationAttributes` usage for the haptic feedback request.

<br />

| Parameters ||
|---|---|
| `usage` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_UNKNOWN` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_ACCESSIBILITY` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_ALARM` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_COMMUNICATION_REQUEST` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_HARDWARE_FEEDBACK` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_MEDIA` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_NOTIFICATION` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_PHYSICAL_EMULATION` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_RINGTONE` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_TOUCH` - `https://developer.android.com/reference/android/os/VibrationAttributes#USAGE_GESTURE_INPUT` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/vibrator/HapticFeedbackRequest.Builder` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/os/VibrationAttributes#getUsage()`