I want to link button in my application with a website as when user click on this button the website open in browser or in application ,, I using kotlin not java ,, How can i make it ? :) i try to use this code :
bu1.setOnClickListener({
var gourl= Intent(this,Uri.parse("https://www.facebook.com/"))
startActivity(gourl)
})
bu1.setOnClickListener({
var gourl= Intent(this,Uri.parse("https://www.facebook.com/"))
startActivity(gourl)
})
bu1.setOnClickListener({
var gourl= Intent(this,Uri.parse("https://www.facebook.com/"))
startActivity(gourl)
})
Do like this:
val url = "http://www.example.com"
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(url)
startActivity(i)
Or like this:
val i = Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com"))
startActivity(i)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With