Advertisement
kusosuha6vt

Untitled

Mar 3rd, 2023
1,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.74 KB | None | 0 0
  1. class MainActivity : AppCompatActivity() {
  2.     override fun onCreate(savedInstanceState: Bundle?) {
  3.         super.onCreate(savedInstanceState)
  4.         setContentView(R.layout.activity_main)
  5.         findViewById<Button>(R.id.btnWeb).setOnClickListener {
  6.             startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://www.ya.ru")))
  7.         }
  8.     }
  9. }
  10.  
  11. class Browser : AppCompatActivity() {
  12.     override fun onCreate(savedInstanceState: Bundle?) {
  13.         super.onCreate(savedInstanceState)
  14.         setContentView(R.layout.activity_browser)
  15.         val webView = findViewById<WebView>(R.id.webView)
  16.         webView.webViewClient = WebViewClient()
  17.         val data: Uri? = intent.data
  18.         webView.loadUrl(data.toString())
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement