2016-05-23 1 views
0

Essayé avec le code ci-dessous et son image en cours, mais pas de texte via la messagerie et cela fonctionne bien avec le courrier électronique, WhatsApp. quelqu'un peut me suggérer comment le faireImage et le texte ne va pas à la fois grâce à la messagerie Android

Uri shareImageUri = saveBitmapImage(result); 
       final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 

       emailIntent.putExtra(Intent.EXTRA_STREAM, shareImageUri); 
       emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Hiiiiiiiiiiiiiiiiiiiiiiii"); 
       emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,"byeeeeeeeeeeee"); 

       emailIntent.setType("image/png"); 
       mActivity.startActivity(Intent.createChooser(emailIntent, "Send mail...")); 

Répondre

0

Essayez ce code:

String fileName = "image_file_name.jpg";//Name of an image 
String externalStorageDirectory = Environment.getExternalStorageDirectory().toString(); 
String myDir = externalStorageDirectory + "/saved_images/"; // the file will be in saved_images 
Uri uri = Uri.parse("file:///" + myDir + fileName); 
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); 
shareIntent.setType("text/html"); 
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Test Mail"); 
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Launcher"); 
shareIntent.putExtra(Intent.EXTRA_STREAM, uri); 
startActivity(Intent.createChooser(shareIntent, "Share Image and Text")); 

ou

File filePath = getFileStreamPath("share_image.jpg"); //optional //internal storage 
    Intent shareIntent = new Intent(); 
    shareIntent.setAction(Intent.ACTION_SEND); 
    shareIntent.putExtra(Intent.EXTRA_TEXT, "share content"); 
    shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(new File(filePath))); //optional//use this when you want to send an image 
    shareIntent.setType("image/jpeg"); 
    shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 
    startActivity(Intent.createChooser(shareIntent, "share")); 
+0

son ne fonctionne pas et le texte ne montrant pas – srinu