Webview in Jetpack Compose Android

Muhammad Danish
Geek Culture
Published in
2 min readJan 6, 2022
https://android-developers.googleblog.com/2020/08/announcing-jetpack-compose-alpha.html

In this article i am going to show you how you can create webview in your android app if you are working with jetpack compose and how you can send intent to external browsers to load web url. Incase of xml we need to define webview tag inside our layout then we need to use that inside our activity/fragment. But as we know in jetpack compose you dont need to define the xml file.

In jetpack compose there is no function/class to create webview because webview is part of android view itself. To create webview inside fragment or activity you need to define the webview like below code:

Thats it below is output of the above function.

Now how can we send web url to other apps to load it? For this we need to send an intent to tell other browsers to load our web url.

Output of the above code:

--

--