如何将SD卡中的多个图像附加到电子邮件中?

Aka*_*ngh 3 android

如何在电子邮件中发送多个图像?我非常希望图像在电子邮件的正文中,而不是附加它.

我运行此代码但不起作用.

Aka*_*ngh 6

其中image_path数组列表用于SD卡的商店图像路径地址

image_path.add(Environment.getExternalStorageDirectory() + "/defaultg1.jpg");
image_path.add(Environment.getExternalStorageDirectory() + "/defaultg2.jpg");

if(image_path.size() > 0 && edt_weight1.getText().length() > 0 && edt_weight2.getText().length() > 0){
            ArrayList<Uri> uris = new ArrayList<Uri>();
            for(int i=0;i<image_path.size();i++){

                   File fileIn = new File(image_path.get(i));
                       Uri u = Uri.fromFile(fileIn);
                       uris.add(u);
                }

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
    emailIntent.setType("image/jpg");
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Enjoy the photo");
    emailIntent.putExtra(Intent.EXTRA_TEXT, "Plz find the attachment.");
    emailIntent.putExtra(Intent.EXTRA_STREAM, uris);
    startActivity(Intent.createChooser(emailIntent, "Email:"));
Run Code Online (Sandbox Code Playgroud)

享受代码......