> Documentation index: https://developer.android.com/reference/llms.txt

# ComposeUiSharedResources

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/platform/ComposeUiSharedResources.android.kt+class:androidx.compose.ui.platform.ComposeUiSharedResources) Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01) Common/AllAndroid/JVM
- android

  ```
  @ExperimentalComposeUiHostApi
  class ComposeUiSharedResources
  ```

*** ** * ** ***

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.

## Summary

| ### Public constructors |
|---|---|
| `ComposeUiSharedResources(initialConfiguration: Configuration)` | android |

| ### Public functions |
|---|---|---|
| `Unit` | `clear()` Clears all cached resources, for example in response to `onTrimMemory`. | android |
| `Unit` | `onConfigurationChanged(newConfiguration: Configuration)` Updates the caches for `newConfiguration`. | android |

## Public constructors

### ComposeUiSharedResources

android Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
ComposeUiSharedResources(initialConfiguration: Configuration)
```

| Parameters |
|---|---|
| `initialConfiguration: Configuration` | The `Configuration` of the `Context` that the hierarchies use. Later changes are reported with `onConfigurationChanged`. |

## Public functions

### clear

android Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun clear(): Unit
```

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

### onConfigurationChanged

android Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun onConfigurationChanged(newConfiguration: Configuration): Unit
```

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.