[ Web Proxy ]
URL:
Viewing: https://developer.android.com/develop/ui/compose/glance/interoperability [Back]  [Original]

Glance interoperability  |  Jetpack Compose  |  Android Developers Skip to main content
Essentials Design & Plan Develop Google Play Blog
Search:
Android Studio
Android Developers [Android Developers]

Glance interoperability Stay organized with collections Save and categorize content based on your preferences.

In some cases, you may want to use XML and RemoteViews to provide a view. Perhaps you have already implemented a feature without Glance, or the feature is not yet available or possible with the current Glance API. For these situations, Glance provides AndroidRemoteViews, an interoperability API.

The AndroidRemoteViews composable allows RemoteViews to be placed together with your other composables:

val packageName = LocalContext.current.packageName
Column(modifier = GlanceModifier.fillMaxSize()) {
    Text("Isn't that cool?")
    AndroidRemoteViews(RemoteViews(packageName, R.layout.example_layout))
}

Create and define the RemoteViews as you would without Glance, and pass it as a parameter.

In addition, you can create RemoteViews containers for your composables:

AndroidRemoteViews(
    remoteViews = RemoteViews(packageName, R.layout.my_container_view),
    containerViewId = R.id.example_view
) {
    Column(modifier = GlanceModifier.fillMaxSize()) {
        Text("My title")
        Text("Maybe a long content...")
    }
}

In this case, a layout that contains the "container" is passed with the defined ID. This container must be a ViewGroup, since it is used to place the defined content.

Note: Any children of the defined container are removed and replaced with the content. Also, the provided ViewGroup must be supported by RemoteViews. See RemoteViewsWidget.kt for an example of using AndroidRemoteViews.
Implement a Glance theme
Additional resources

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 2026-08-03 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-03 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page