Skip to content

Instantly share code, notes, and snippets.

@5AbhishekSaxena
Created December 14, 2021 14:24
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/969a711c99dd1eca244adb49cc64811a to your computer and use it in GitHub Desktop.
Save 5AbhishekSaxena/969a711c99dd1eca244adb49cc64811a to your computer and use it in GitHub Desktop.
Default sharing intent type
class DefaultSharingIntent(
private val context: Context,
private val body: String,
chooserTitle: String = "Share using",
) : SharingIntent {
override val intentChooserTitle: String = chooserTitle
override fun prepareIntent(): Intent {
return ShareCompat.IntentBuilder(context)
.setType("text/plain")
.setText(body)
.intent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment