簡體   English   中英

如何將SD卡中的多個圖像附加到電子郵件中?

[英]How to attach mutiple images from the SD-card to email?

如何在電子郵件中發送多個圖像? 我非常希望圖像在電子郵件的正文中,而不是附加它。

我運行此代碼但不起作用。

其中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:"));

享受代碼......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM