Android‎ > ‎

Share Intent : Android

posted Feb 14, 2013, 1:52 AM by Akash Khaitan   [ updated Mar 9, 2013, 7:54 AM ]
Share image and text in Gmail, Facebook, Messaging, etc from your app.
The image shared must be in Sdcard, so that the intent can access and attach it

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
String shareBody = "Here is the share content body";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
String fileName=Environment.getExternalStorageDirectory()+"/test.jpg";
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));