Posts

[ Kotlin ] Webview - Load uri in Android App

                                       "Click here" To Watch Video tutorial

Step 1 :
  • Create New Project With EmptyActivity
Step 2 :
  • Add WebView in xml file 
  • Add internet permission
  • <uses-permission android:name="android.permission.INTERNET"/>
  • copy paste following code to MainActivity.java
var mywebview: WebView? = null
mywebview = findViewById<WebView>(R.id.webview)
mywebview!!.webViewClient = object : WebViewClient() {
    override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
        view?.loadUrl(url)
        return true    }
}
mywebview!!.loadUrl("https://www.google.co.in/")
Step 4 : 
  • Run Your App
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.