Last active
January 23, 2022 18:39
-
-
Save harry-private/a3d3b104b166742cd97b68457e92667b to your computer and use it in GitHub Desktop.
For medium article How to add WebView in Jetpack Comose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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