WearWidgetContentTooLargeException

class WearWidgetContentTooLargeException : RuntimeException


Thrown when the serialized content of a widget is too large to be sent to the host.

This is usually caused by large bitmaps in RemoteImage, which are embedded losslessly at full resolution in the widget content. To avoid this, scale bitmaps down to their displayed size (e.g. using android.graphics.Bitmap.createScaledBitmap) or remove unnecessary images.

Summary

Constants

const Int

The maximum size of the serialized widget content that can be sent to the host, in bytes (400 KB).

Public properties

Int

the size of the serialized widget content, in bytes.

Constants

MAX_CONTENT_SIZE_BYTES

const val MAX_CONTENT_SIZE_BYTES: Int

The maximum size of the serialized widget content that can be sent to the host, in bytes (400 KB).

The content is sent inline over oneway Binder calls, whose ~508 KB buffer is shared with other transactions in flight. This limit leaves headroom for those and for the extras and parcel overhead.

Public properties

contentSizeBytes

Added in 1.0.0-alpha22
val contentSizeBytes: Int

the size of the serialized widget content, in bytes.