Click a button to open URL.
1
2
3
4
5
6
7
8
hBottom.kStreetViewLink.setOnClickListener {
val hStreetURL = "YOUR-URL-HERE"
val openURL = Intent(Intent.ACTION_VIEW)
openURL.data = Uri.parse(hStreetURL)
startActivity(openURL)
}
Where:
1️⃣ Specify the element to monitor, and use the .setOnClickListener event to check if the user clicks the element specified.
3️⃣ Provide the target URL here.
Expected outcome:
- Launch the user's default browser.
- Go to the target URL using the default browser.