-
-
Save virendersran01/19edd5a5bbdec943694632832bfc5e63 to your computer and use it in GitHub Desktop.
A better way to open a link in the user's browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val url = Uri.parse("https://www.asos.com/") | |
val browserSelectorIntent = Intent() | |
.setAction(Intent.ACTION_VIEW) | |
.addCategory(Intent.CATEGORY_BROWSABLE) | |
.setData(Uri.parse("http:")) | |
val targetIntent = Intent() | |
.setAction(Intent.ACTION_VIEW) | |
.addCategory(Intent.CATEGORY_BROWSABLE) | |
.setData(url) | |
targetIntent.selector = browserSelectorIntent | |
startActivity(targetIntent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment