Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#nestedclasses) \| [Inherited Constants](https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#inhconstants) \| [Fields](https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#lfields) \| [Methods](https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#inhmethods)

# MultiLightEffect

*** ** * ** ***


`
public

final

class
MultiLightEffect
`


`

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


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

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

<br />

*** ** * ** ***

Models an effect that will be shown in one or more lights.


Effects are comprised of \[light, ColorSequence\] pairs defining how each light should change over
time along with some extra configuration values:

- Iterations: the number of times the effect will be played back to back.
- Preemptive: whether this effect should preempt any previously playing state or if it should be played after the current effect finishes.


A MultiLightEffect is treated as a unit with a given start time and an implicit duration:

- Start time: all lights sequences in the effect start at the same time, regardless of having a initial state or not.
- Duration: the duration of the effect is the duration of the longest sequence it contains. If a light sequence in the effect is shorter than the effect duration, the light will remain as a solid color until the end of the effect.


`https://developer.android.com/reference/android/hardware/lights/ColorSequence`s in the effect could have initial states (`delay=0`) for their
corresponding lights, which has special implications when the effect will be played as a
continuation of another effect (effects with `preemptive=false` and/or effects with initial
states and more than one iteration).


The initial state will be applied only if the effect is set to preemptive and it is the first
iteration of the effect. The system ignores the initial state in subsequent iterations or in
effects with `preemptive=false` to allow the light to transition smoothly and avoid flicks.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/hardware/lights/MultiLightEffect.Builder` Builder for `https://developer.android.com/reference/android/hardware/lights/MultiLightEffect` objects. |

| ### Inherited constants |
|---|
| From interface `https://developer.android.com/reference/android/os/Parcelable` |---|---| | `int` | `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor. | | `int` | `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/hardware/lights/MultiLightEffect>` | `https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#CREATOR` Implement the Parcelable interface |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#describeContents()() ` Implement the Parcelable interface |
| ` int` | ` https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#getIterations()() ` Returns the number of times this effect will be played in a loop. |
| ` https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/Integer, https://developer.android.com/reference/android/hardware/lights/ColorSequence>` | ` https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#getSequences()() ` Returns the color sequences defined in the light effect for each of the lights. |
| ` boolean` | ` https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#isPreemptive()() ` Returns whether this effect will cancel any previously playing effect. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/hardware/lights/MultiLightEffect#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Implement the Parcelable interface |

| ### 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*. | ||
| From interface ` https://developer.android.com/reference/android/os/Parcelable ` |---|---| | ` abstract int` | ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. | | ` abstract void` | ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. | ||

## Fields

### CREATOR

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

```
public static final Creator<MultiLightEffect> CREATOR
```

Implement the Parcelable interface

<br />

## Public methods

### describeContents

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

```
public int describeContents ()
```

Implement the Parcelable interface

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### getIterations

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

```
public int getIterations ()
```

Returns the number of times this effect will be played in a loop. Defaults to 1.

<br />

| Returns ||
|---|---|
| `int` | the number of iterations to play. <br /> |

### getSequences

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

```
public Map<Integer, ColorSequence> getSequences ()
```

Returns the color sequences defined in the light effect for each of the lights.


The key for the returned map corresponds to the lightId (see `https://developer.android.com/reference/android/hardware/lights/Light#getId()`) of the
light that will play the color sequence represented by the value.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Map<https://developer.android.com/reference/java/lang/Integer, https://developer.android.com/reference/android/hardware/lights/ColorSequence>` | the Map of lightIds to the color sequences that will be played for the effect. This value cannot be `null`. <br /> |

### isPreemptive

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

```
public boolean isPreemptive ()
```

Returns whether this effect will cancel any previously playing effect.

<br />

| Returns ||
|---|---|
| `boolean` | true if this effect applies immediately, false otherwise. <br /> |

### toString

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

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Implement the Parcelable interface

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |