Created
August 1, 2015 07:07
-
-
Save dp-singh/0a8ab7efbda5d8f411a5 to your computer and use it in GitHub Desktop.
Sharing image and text though whatsapp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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