I want to implement sharing functionality that allows the user to share a url via text message, facebook, email, etc. Is there a share sheet functionality in kotlin/android as there is in ios?How can I access that using kotlin code?
Asked
Active
Viewed 612 times
1
-
I suggest you google "share android" or something similar to find the official documentation that explains how to do this. – Code-Apprentice Mar 12 '20 at 17:02
2 Answers
3
Yes there is something called Android Sharesheet. You have examples on next link https://developer.android.com/training/sharing/send

sela
- 314
- 1
- 11
2
This should be helpful for you:
val sharingIntent = Intent(Intent.ACTION_SEND)
sharingIntent.type = "text/plain"
val shareBody = "Text to be shared"
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject")
sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody)
context.startActivity(Intent.createChooser(sharingIntent, "Share using ..."))

Firzen
- 1,909
- 9
- 28
- 42