I have an app, and I'd like to add a share button to it. Once the button is clicked, I'd like it to open the following window:
Then the user will choose where to share it and it will display the following default message: "Just found this great app! Find it here:https://play.google.com/store/apps/details?id=com.ideashower.readitlater.pro"
Can you please tell me how to do it?
Solution 1: Launch ACTION_SEND Intent
When launching a SEND intent, you should usually wrap it in a chooser (through createChooser(Intent, CharSequence)), which will give the proper interface for the user to pick how to send your data and allow you to specify a prompt indicating what they are doing.
Solution 2: Use ShareActionProvider
If you are just looking to add a Share button in Overflow Menu, also have a look at ShareActionProvider.
Hope this helps. :)
As explained on Android Developers on this link: http://developer.android.com/training/sharing/shareaction.html
you have to add this menu item:
Then add the following code in Activity: