Skip to content

Instantly share code, notes, and snippets.

@harry-private
Last active January 23, 2022 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harry-private/a3d3b104b166742cd97b68457e92667b to your computer and use it in GitHub Desktop.
Save harry-private/a3d3b104b166742cd97b68457e92667b to your computer and use it in GitHub Desktop.
For medium article How to add WebView in Jetpack Comose
@composable
fun SomeComposeFunction(){
val application = context.applicationContext as App
WebView(
"https://www.google.com",
application
)
// For handling the back press
BackHandler {
if (application.myView != null) {
if (application.myView!!.canGoBack()) {
application.myView!!.goBack()
} else {
application.myView = null
navController.popBackStack()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment