Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Constants](https://developer.android.com/reference/android/os/VibrationEffect.Preset#constants) \| [Methods](https://developer.android.com/reference/android/os/VibrationEffect.Preset#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/os/VibrationEffect.Preset#inhmethods)

# VibrationEffect.Preset

*** ** * ** ***


`
public
static
final

class
VibrationEffect.Preset
`


`

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


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.os.VibrationEffect.Preset |

<br />

*** ** * ** ***

Represents a predefined haptics pattern, corresponding to
`https://developer.android.com/`.

These presets are building blocks that can be added to a `https://developer.android.com/reference/android/os/VibrationEffect.Builder`
to create more complex haptic compositions. They represent common, short haptic sensations.

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/os/VibrationEffect.Preset#PRESET_CLICK` A sharp, short pulse sensation. |
| `int` | `https://developer.android.com/reference/android/os/VibrationEffect.Preset#PRESET_LOW_TICK` A very short, low-frequency pulse sensation. |
| `int` | `https://developer.android.com/reference/android/os/VibrationEffect.Preset#PRESET_TICK` A very short pulse sensation. |

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/android/os/VibrationEffect.Preset` | ` https://developer.android.com/reference/android/os/VibrationEffect.Preset#create(int,%20float)(int presetId, float scale) ` Creates a new haptic `https://developer.android.com/reference/android/os/VibrationEffect.Preset` with the specified ID and scale. |
| ` static https://developer.android.com/reference/android/os/VibrationEffect.Preset` | ` https://developer.android.com/reference/android/os/VibrationEffect.Preset#create(int)(int presetId) ` Creates a new haptic `https://developer.android.com/reference/android/os/VibrationEffect.Preset` with the specified ID. |

### 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*.


## Constants

### PRESET_CLICK

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

```
public static final int PRESET_CLICK
```

A sharp, short pulse sensation. This is the unified identifier for a click effect.

<br />

Constant Value:

1
(0x00000001)


### PRESET_LOW_TICK

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

```
public static final int PRESET_LOW_TICK
```

A very short, low-frequency pulse sensation. This is the unified identifier for a low
tick effect.

<br />

Constant Value:

8
(0x00000008)


### PRESET_TICK

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

```
public static final int PRESET_TICK
```

A very short pulse sensation. This is the unified identifier for a tick effect.

<br />

Constant Value:

7
(0x00000007)


## Public methods

### create

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

```
public static VibrationEffect.Preset create (int presetId, 
                float scale)
```

Creates a new haptic `https://developer.android.com/reference/android/os/VibrationEffect.Preset` with the specified ID and scale.

<br />

| Parameters ||
|---|---|
| `presetId` | `int`: The ID of the preset to create. Value is one of the following: - `https://developer.android.com/reference/android/os/VibrationEffect.Preset#PRESET_CLICK` - `https://developer.android.com/reference/android/os/VibrationEffect.Preset#PRESET_TICK` - `https://developer.android.com/reference/android/os/VibrationEffect.Preset#PRESET_LOW_TICK` |
| `scale` | `float`: The scale to apply to the preset's intensity, ranging from 0 to 1. Value is between 0.0f and 1.0f inclusive <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/VibrationEffect.Preset` | The created `https://developer.android.com/reference/android/os/VibrationEffect.Preset`. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the `scale` is not between 0 and 1. |

### create

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

```
public static VibrationEffect.Preset create (int presetId)
```

Creates a new haptic `https://developer.android.com/reference/android/os/VibrationEffect.Preset` with the specified ID.

<br />

| Parameters ||
|---|---|
| `presetId` | `int`: The ID of the preset to create. Value is one of the following: - `https://developer.android.com/reference/android/os/VibrationEffect.Preset#PRESET_CLICK` - `https://developer.android.com/reference/android/os/VibrationEffect.Preset#PRESET_TICK` - `https://developer.android.com/reference/android/os/VibrationEffect.Preset#PRESET_LOW_TICK` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/VibrationEffect.Preset` | The created `https://developer.android.com/reference/android/os/VibrationEffect.Preset`. This value cannot be `null`. <br /> |