Android Intent Open Url in Browser

September 28, 2018
val url = "https://www.luasoftware.com/luapass/privacy/"
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))

if (intent.resolveActivity(activity?.packageManager) != null) {
    startActivity(intent)
}

NOTE: If your app open URL frequently (e.g. News or RSS Reader), you might want to try Chrome Custom Tabs for faster performance, better navigation and theming.

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.