Posts

android letest update

  ViewCompositionStrategy Demystified In Jetpack Compose, a Composition is a tree-like structure describing the UI of your app and is produced by running composables. When the Composition is no longer needed, state will no longer be tracked by Jetpack Compose, and the Composition gets disposed so that resources can be released. ViewCompositionStrategy  defines when the Composition should be disposed. The default,  ViewCompositionStrategy.Default , disposes the Composition when the underlying  ComposeView  detaches from the window, unless it is part of a pooling container such as a  RecyclerView . However, if you are incrementally adding Compose in your codebase, this behavior may cause state loss in some scenarios. For example, if you are seeing weird glitches like scroll positions getting reset in your Fragment-based Compose app, perhaps you are using the wrong  ViewCompositionStrategy  (you should be using one of the Lifecycle-based strategies instead). In this blog post, I’ll cover