2

Jetpack released a tool called "Glance" that we can replace RemoteViews XML widgets.

I wonder how it converts compose layouts to RemoteViews.

Adinia
  • 3,722
  • 5
  • 40
  • 58
Ayaka_Ago
  • 89
  • 9

1 Answers1

2

It does use XML underneath. It uses compose runtime to parse the node-tree, then it takes the corresponding pre-generated XML file and uses remoteviews to modify it's attributes. Then it composes everything into a single RemoteView that is sent to the AppWidget manager.

You can dive in into the code yourself. It's open source ;) https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:glance

Marcel
  • 2,094
  • 3
  • 23
  • 37