beom
02/14/2025, 3:16 AMbeom
02/14/2025, 3:18 AMval LocalWebView = staticCompositionLocalOf<WebView?> { null }
// in activity
CompositionLocalProvider(
LocalWebView provides WebView(context)
) { ... }
// use internal composable
val webView = LocalWebView.current
AndroidView(factory = { webView... }, ...)
Alex Styl
02/14/2025, 4:19 AMbeom
02/14/2025, 4:56 AMAlex Styl
02/14/2025, 10:32 AMbeom
02/14/2025, 10:43 AMbeom
02/14/2025, 10:45 AM// in activity
onCreate(...) {
setContent {
MainNavHost { // custom navhost
composable(...) { AScreen(webView) }
// AScreen in A module
composable(...) { BScreen(webView) }
// BScreen in B module
...
}
}
}
// using other function in activity
onPause(...) { webView.onPause() }
Alex Styl
02/14/2025, 11:21 AMbeom
02/14/2025, 11:33 AMAlex Styl
02/14/2025, 12:27 PMbeom
02/14/2025, 12:40 PM