Android Studio Share button

Ryan picture Ryan · Feb 10, 2015 · Viewed 19.3k times · Source

I wanted to make a share button on a Navigation drawer, when the user touches the button it will open up that black drawer with the list of all applications and the user can share the apps Google play link. Is there any generic code template? the only answers I have found is to just share it on one application such as Facebook which seems useless because not everyone uses Facebook.

Answer

yusufiga picture yusufiga · Feb 10, 2015

Use share intent http://developer.android.com/training/sharing/send.html

sample code

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);