Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder#inhmethods)

# LightsRequest.Builder

*** ** * ** ***


`
public
static
final

class
LightsRequest.Builder
`


`

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


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.hardware.lights.LightsRequest.Builder |

<br />

*** ** * ** ***

Builder for creating device light change requests.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder#Builder()() ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder` | ` https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder#addLight(android.hardware.lights.Light,%20android.hardware.lights.LightState)(https://developer.android.com/reference/android/hardware/lights/Light light, https://developer.android.com/reference/android/hardware/lights/LightState state) ` Overrides the color and intensity of a given light. |
| ` https://developer.android.com/reference/android/hardware/lights/LightsRequest` | ` https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder#build()() ` Create a LightsRequest object used to override lights on the device. |
| ` https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder` | ` https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder#clearLight(android.hardware.lights.Light)(https://developer.android.com/reference/android/hardware/lights/Light light) ` Removes the override for the color and intensity of a given light. |
| ` https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder` | ` https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder#setEffect(android.hardware.lights.MultiLightEffect)(https://developer.android.com/reference/android/hardware/lights/MultiLightEffect effect) ` Applies an effect to a set of lights configured in the effect object. |

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

```
public Builder ()
```

<br />

<br />

## Public methods

### addLight

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LightsRequest.Builder addLight (Light light, 
                LightState state)
```

Overrides the color and intensity of a given light.

<br />

| Parameters ||
|---|---|
| `light` | `Light`: the light to modify. This value cannot be `null`. <br /> |
| `state` | `LightState`: the desired color and intensity of the light. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder` | This value cannot be `null`. <br /> |

### build

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LightsRequest build ()
```

Create a LightsRequest object used to override lights on the device.

The generated `https://developer.android.com/reference/android/hardware/lights/LightsRequest` should be used in
`https://developer.android.com/reference/android/hardware/lights/LightsManager.LightsSession#requestLights(android.hardware.lights.LightsRequest)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/lights/LightsRequest` | This value cannot be `null`. <br /> |

### clearLight

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LightsRequest.Builder clearLight (Light light)
```

Removes the override for the color and intensity of a given light.

<br />

| Parameters ||
|---|---|
| `light` | `Light`: the light to modify. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder` | This value cannot be `null`. <br /> |

### setEffect

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LightsRequest.Builder setEffect (MultiLightEffect effect)
```

Applies an effect to a set of lights configured in the effect object.


The system allows a maximum of one effect playing per session plus an additional slot for
a non-preemptive effect waiting to be played, which means applications must combine all
light effects in to a single `https://developer.android.com/reference/android/hardware/lights/MultiLightEffect` to play animations with multiple
lights.


If another session with higher priority is currently using a light needed by this effect,
the effect will not play until the current session has control of all the lights it needs
for playback. In a similar way, if the effect is playing and this or another session with
higher priority requests a light needed by this effect, the effect will stop playing as
if it was preempted.

<br />

| Parameters ||
|---|---|
| `effect` | `MultiLightEffect`: the light effect ot add to the request. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/lights/LightsRequest.Builder` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/hardware/lights/Light#hasAnimationControl()`