Skip to content

Instantly share code, notes, and snippets.

@dp-singh
Created August 1, 2015 07:07
Show Gist options
  • Save dp-singh/0a8ab7efbda5d8f411a5 to your computer and use it in GitHub Desktop.
Save dp-singh/0a8ab7efbda5d8f411a5 to your computer and use it in GitHub Desktop.
Sharing image and text though whatsapp
try{
shareIntent.setAction(Intent.ACTION_SEND);
//Target whatsapp:
shareIntent.setPackage("com.whatsapp");
//Add text and then Image URI
shareIntent.putExtra(Intent.EXTRA_TEXT, picture_text);
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
shareIntent.setType("image/jpeg");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(shareIntent);
} catch (android.content.ActivityNotFoundException ex) {
ToastHelper.MakeShortText("Whatsapp have not been installed.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment