Skip to content

Commit

Permalink
Use ShareCompat.IntentBuilder in "shareText()" utility function.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjohndoe committed Dec 16, 2021
1 parent 9118df3 commit ddf8bf6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,10 @@ fun shareMedia(context: Context, file: File, mediaMimeType: String?) {
}

fun shareText(context: Context, text: String) {
val sendIntent = Intent()
sendIntent.action = Intent.ACTION_SEND
sendIntent.type = "text/plain"
sendIntent.putExtra(Intent.EXTRA_TEXT, text)
val sendIntent = ShareCompat.IntentBuilder(context)
.setType("text/plain")
.setText(text)
.intent

sendShareIntent(context, sendIntent)
}
Expand Down

0 comments on commit ddf8bf6

Please sign in to comment.