WebView is a view that is used to display web pages inside the app. It is used to turn the app into a web application. In this article let’s display the https://www.geeksforgeeks.org/ inside the Android Application using Kotlin.
Note: To implement Android WebView in Java please refer How to use WebView in Android using Java.
kotlin.Any android.view.View android.view.ViewGroup android.widget.AbsoluteLayout android.webkit.WebView
Step 1: Create a new project
To create a new project in android studio please refer, how to Create/Start a New Project in Android Studio.
Step 2: Modify activity_main.xml
This is used to set the front end of the Application, we place the WebView in the front end.
Step 3: Modify MainActivity.kt
This is the back end of the Application, here we assign values to the views and actions to the views.
Step 4: Modify AndroidManifest.xml
In AndroidManifest.xml, one needs to include the below permission, in order to access the internet.
Output: Run on Emulator
When we run the application either on the Emulator or on the Android Smartphone we can see this as our output. Remember to turn on the internet on your device.
- How to create project in Android Studio using Kotlin
- Android EditText in Kotlin
- Android LinearLayout in Kotlin
- Android RelativeLayout in Kotlin
- Android ListView in Kotlin
- Android FrameLayout in Kotlin
- Android TableLayout in Kotlin
- Android Toast in Kotlin
- Android Fade In/Out in Kotlin
- Android Slide Up/Down in Kotlin
- Android Animations in Kotlin
- Android progress notifications in Kotlin
- Kotlin Android Tutorial
- Difference between Java and Kotlin in Android with Examples
- Why You Should Switch to Kotlin from Java to Develop Android Apps?
- How to send message on WhatsApp in Android using Kotlin
- Thread Priority in Kotlin & Android
- Running User Interface Thread in Android using Kotlin
- How to Add RangeSeekbar in Android Using Kotlin?
- How to add a custom styled Toast in Android using Kotlin
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.