I am developing an inspirational quotes application and I want my users to share the quotes they see before them to other applications(Such as Twitter,facebook,whatsapp,etc) if they click on the share button or the menu share button, it should automatically picks the text on that Interface, not me inputting one particular text because the texts varies base on the particular interface the user is viewing the code.(I am using a recycler view and view pager with holders and adpaters so the user scroll down on one page) please help me with the code.
Asked
Active
Viewed 36 times
-2
-
What you have done for your users please show that. show your code – Amit Vaghela Apr 20 '16 at 08:22
-
1Possible duplicate of [Android Share Via Dialog](http://stackoverflow.com/questions/3553017/android-share-via-dialog) – Arun Shankar Apr 20 '16 at 08:33
-
Question is unspecific, where should the user be able to share to? Are you talking about Facebook, Twitter etc. ? – Christian Stengel Apr 20 '16 at 08:42
1 Answers
0
try this code
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(Intent.EXTRA_TEXT, text); //Add your quote here
sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "From Your Application"); //Add a Subject here
startActivity(Intent.createChooser(sharingIntent, "Share via.."));

Arun Shankar
- 2,603
- 2
- 26
- 36