Provides the reason as to why LocalContext.current as Activity is not suitable a suitable approach to get an Activity instance in Jetpack compose projects
The android system's view pipeline consists of two stages - measure and layout processes whereby the android framework measures the sizes of each view present in a view hierarchy (viewgroup
) and proceeds to position them in specific positions on the screen. What this means is that the android framework only knows how to draw views on the android canvas.
Compose uses a similar logic to draw ui on its[compose] canvas. First, as you already know, Composes uses layout-nodes instead of views and for these nodes to be correctly positioned and drawn on the screen, it uses something called an applier(UiApplier
).
As the name suggests the UiApplier transverses through the layout-nodes measuring and laying out (drawing) the nodes in specific positions on the Compose canvas. Think of compose system as a tree and the layout nodes as leaves.
Whatever is dra