display.sendContent {
flexBox { text("Hello") }
}.onFailure { error ->
when (error) {
DisplayError.DEVICE_DISCONNECTED -> showReconnectPrompt()
DisplayError.INVALID_SESSION_STATE -> restartDisplay()
DisplayError.RENDERING_FAILED -> showRenderError()
DisplayError.UNEXPECTED_ERROR -> showGenericError()
}
}
enum DisplayError : Enum<DisplayError> , DatError
| Member | Description |
|---|---|
DEVICE_DISCONNECTED |
Device is not connected or became disconnected during the operation.
|
INVALID_SESSION_STATE |
The display capability is not in the required state for the requested operation.
|
RENDERING_FAILED |
Failed to render display content on the wearable device.
|
UNEXPECTED_ERROR |
An unexpected error occurred during the display operation.
|
description
: String
[Get] |
A human-readable description of the error suitable for logging and debugging purposes.
Signature
open override val description: String |
getLocalizedDescription
(
context
)
|
Returns a localized description of the error using Android string resources when available.
Signature
open override fun getLocalizedDescription(context: Context?): String Parameters context: Context?
Optional Android context for accessing string resources. If null or if no localized string is available, returns the default DisplayError.description.
Returns String
The localized error description, or the default description if localization unavailable.
|