Skip to content

Instantly share code, notes, and snippets.

@asanand3
Created August 11, 2015 09:35
Show Gist options
  • Save asanand3/2e2c5851817833885454 to your computer and use it in GitHub Desktop.
Save asanand3/2e2c5851817833885454 to your computer and use it in GitHub Desktop.
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/jpeg");
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hi"); //set your subject
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "How are you"); //set your message
String imagePath = Environment.getExternalStorageDirectory() + File.separator + "test.jpg";
File imageFileToShare = new File(imagePath);
Uri uri = Uri.fromFile(imageFileToShare);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(shareIntent, "Share Image"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment