Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder for creating device light change requests.
Summary
Public constructors
Public methods
addLight
fun addLight(
light: Light,
state: LightState
): LightsRequest.Builder
Overrides the color and intensity of a given light.
Parameters |
light |
Light: the light to modify This value cannot be null . |
state |
LightState: the desired color and intensity of the light This value cannot be null . |
build
fun build(): LightsRequest
Create a LightsRequest object used to override lights on the device.
The generated LightsRequest
should be used in LightsManager.Session#requestLights(LightsLightsRequest)
clearLight
fun clearLight(light: Light): LightsRequest.Builder
Removes the override for the color and intensity of a given light.
Parameters |
light |
Light: the light to modify This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# LightsRequest.Builder\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/hardware/lights/LightsRequest.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|----------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.hardware.lights.LightsRequest.Builder](#) |\n\nBuilder for creating device light change requests.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|--------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [LightsRequest.Builder](#) | [addLight](#addLight(android.hardware.lights.Light,%20android.hardware.lights.LightState))`(`light:` `[Light](/reference/kotlin/android/hardware/lights/Light)`, `state:` `[LightState](/reference/kotlin/android/hardware/lights/LightState)`)` Overrides the color and intensity of a given light. |\n| [LightsRequest](/reference/kotlin/android/hardware/lights/LightsRequest) | [build](#build())`()` Create a LightsRequest object used to override lights on the device. |\n| [LightsRequest.Builder](#) | [clearLight](#clearLight(android.hardware.lights.Light))`(`light:` `[Light](/reference/kotlin/android/hardware/lights/Light)`)` Removes the override for the color and intensity of a given light. |\n\nPublic constructors\n-------------------\n\n### Builder\n\n```\nBuilder()\n```\n\nPublic methods\n--------------\n\n### addLight\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun addLight(\n light: Light, \n state: LightState\n): LightsRequest.Builder\n```\n\nOverrides the color and intensity of a given light.\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `light` | [Light](/reference/kotlin/android/hardware/lights/Light): the light to modify This value cannot be `null`. |\n| `state` | [LightState](/reference/kotlin/android/hardware/lights/LightState): the desired color and intensity of the light This value cannot be `null`. |\n\n| Return ||\n|----------------------------|------------------------------|\n| [LightsRequest.Builder](#) | This value cannot be `null`. |\n\n### build\n\n```\nfun build(): LightsRequest\n```\n\nCreate a LightsRequest object used to override lights on the device.\n\nThe generated [LightsRequest](/reference/kotlin/android/hardware/lights/LightsRequest) should be used in LightsManager.Session#requestLights(LightsLightsRequest) \n\n### clearLight\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun clearLight(light: Light): LightsRequest.Builder\n```\n\nRemoves the override for the color and intensity of a given light.\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------------------------------|\n| `light` | [Light](/reference/kotlin/android/hardware/lights/Light): the light to modify This value cannot be `null`. |\n\n| Return ||\n|----------------------------|------------------------------|\n| [LightsRequest.Builder](#) | This value cannot be `null`. |"]]