Class

ComposeUiSharedResources

Resource caches shared by Compose hierarchies that use the same Context, such as the caches used by painterResource to resolve drawable resources.

Source set: Android
public class ComposeUiSharedResources(initialConfiguration: Configuration)

Resource caches shared by Compose hierarchies that use the same Context, such as the caches used by painterResource to resolve drawable resources.

Share one instance between hierarchies whose Context has the same Configuration. Cached entries can depend on the configuration, so sharing an instance between different configurations can resolve the wrong resource variant.

Parameters

initialConfiguration The Configuration of the Context that the hierarchies use. Later changes are reported with onConfigurationChanged.

Functions

onConfigurationChanged

Source set: Android
public fun onConfigurationChanged(newConfiguration: Configuration)

Updates the caches for newConfiguration. Entries that depend on a changed part of the configuration are removed. Any change clears the resource id cache.

Calling this again with an unchanged configuration has no effect.

clear

Source set: Android
public fun clear()

Clears all cached resources, for example in response to onTrimMemory.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: