I want to set a bitmap in android proto tile for wear. We can set the image using Image Builder class. But i do not find any method in proto tile to set the bitmap image in android. I am using below wear tile libraries. Thanks!!
// Use to implement support for wear tiles
implementation "androidx.wear.tiles:tiles:1.3.0-beta01"
// Use to utilize standard components and layouts in your tiles
implementation "androidx.wear.protolayout:protolayout:1.1.0-beta01"
// Use to utilize components and layouts with Material Design in your tiles
implementation "androidx.wear.protolayout:protolayout-material:1.1.0-beta01"
// Use to include dynamic expressions in your tiles
implementation "androidx.wear.protolayout:protolayout-expression:1.1.0-beta01"
// Use to preview wear tiles in your own app
debugImplementation "androidx.wear.tiles:tiles-renderer:1.3.0-beta01"
// Use to fetch tiles from a tile provider in your tests
testImplementation "androidx.wear.tiles:tiles-testing:1.3.0-beta01"
}```
On tiles you can set either a andorid resource id or a image byte array. In your case, if the image is dynamic (is not set as a internal resource) you need to convert it to byte array and then set it.
(I recommend for you to convert the image to byte array outside the tile service, in the editor activity for example, to save resources and battery)
I got a code for converting drawable into byte array, in case u want:
To convert the byte[] to string you can:
Then you can set it on tile in the "onResourcesRequest":
Then you set the image using its ID...
Edit: The libraries I use