Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.firstapplication
- import androidx.appcompat.app.AppCompatActivity
- import android.os.Bundle
- import android.webkit.WebViewClient
- import androidx.databinding.DataBindingUtil
- import com.example.firstapplication.databinding.ActivityMainBinding
- class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
- // this part
- var bind : ActivityMainBinding? = null
- bind = DataBindingUtil.setContentView(this, R.layout.activity_main) // binding layout
- bind?.webview?.webViewClient = WebViewClient() // to open the link in my app not in phone's browser
- bind?.webview?.settings?.javaScriptEnabled = true // to load that websites which will not work except JS
- bind?.webview?.loadUrl("https://www.google.com") // link of the website which we want to show
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement