Rafiul Islam
11/07/2021, 2:12 PMval activity = LocalContext.current as Activity
But I never found the answer.Adam Powell
11/07/2021, 3:56 PMAdam Powell
11/07/2021, 3:58 PMLocalContext is not an Activity, but instead it can be a chain of `ContextWrapper`s where the .baseContext leads to an Activity eventuallyAdam Powell
11/07/2021, 3:59 PMContextThemeWrapper has been used to change the theme mid-view hierarchy. If you use the android:theme attribute in layout xml, one of these is created for you. If a ComposeView is placed as a child of such a subtree, LocalContext will be one of these wrappers.Adam Powell
11/07/2021, 4:00 PM() -> Unit callback or similar to your composable and provide a lambda that makes the actual activity call. This can often aid in testabilityAdam Powell
11/07/2021, 4:02 PMRafiul Islam
11/07/2021, 4:44 PMRafiul Islam
11/07/2021, 4:54 PMAdam Powell
11/07/2021, 4:57 PMContextThemeWrapper around a Service context, getSystemService to get the WindowManager, and add a ComposeView to it as a top-level window with the right lifecycle dependencies configured. At that point you have no activity, but you have a perfectly functional compose uiAdam Powell
11/07/2021, 4:59 PMRafiul Islam
11/07/2021, 5:07 PM