Skip to content

Instantly share code, notes, and snippets.

@5AbhishekSaxena
Created December 14, 2021 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5AbhishekSaxena/b75d8df7f784d940b330a9a7f26084db to your computer and use it in GitHub Desktop.
Save 5AbhishekSaxena/b75d8df7f784d940b330a9a7f26084db to your computer and use it in GitHub Desktop.
Web URL sharing intent
class WebBrowserSharingIntent(
private val url: String,
chooserTitle: String = "Please select the web browser",
) : SharingIntent {
override val intentChooserTitle: String = chooserTitle
override fun prepareIntent(): Intent {
return Intent().apply {
action = Intent.ACTION_VIEW
data = url.toUri()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment