Hello,
I am new in Kotlin. With Android Studio I am trying to create a small apk with buttons or textview to link to a https. First I did it with WebView which works properly, the problem is that I can’t see pop up messages. So I am trying to open the links with a browser, but the url change to http instead https
In MainActivity.kt
val btnViajes = findViewById<Button>(R.id.viajes)
btnViajes?.setOnClickListener() {
val activityWebViajes = Intent(this,webViajes::class.java)
startActivity(activityWebViajes)
}
In other activity.kt
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_web_viajes)
background = findViewById<LinearLayout>(R.id.back) as LinearLayout
mWebView = findViewById(R.id.webView)
mWebView.loadUrl(""https://****/***";")
val webSetting = mWebView.settings
webSetting.javaScriptEnabled = true
mWebView.webViewClient = WebViewClient()
}
Also I have tried, searching google, in MainActivity.kt this:
val btnViajes = findViewById<Button>(R.id.viajes)
btnViajes?.setOnClickListener() {
var url = "https://****/***";
startActivity(Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse(url)
})
}
The problem is the same it opens a browser with a link without https. I would like to know how to open https url in a browser.