从android中的资产在电子邮件中附加多个图像

从android中的资产在电子邮件中附加多个图像,android,Android,我想从资源文件夹附加多个图像。电子邮件发送成功已满,但未获取附加图像。在电子邮件0 kb中显示图像。 我的代码在这里。请告诉我你的想法。其他任何发送多个图像的方式 final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); emailIntent.setType("jpeg/image"); emailIntent.putExtra(android.cont

我想从资源文件夹附加多个图像。电子邮件发送成功已满,但未获取附加图像。在电子邮件0 kb中显示图像。 我的代码在这里。请告诉我你的想法。其他任何发送多个图像的方式

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
        emailIntent.setType("jpeg/image");
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);


        ArrayList<Uri> uris = new ArrayList<Uri>();
        //convert from paths to Android friendly Parcelable Uri's
        for (int i=0; i < arrImageslist.size(); i++)
        {
            Uri u=Uri.parse("file:///android_asset/DiseaseImages/"+arrImageslist.get(i)); 
            uris.add(u);


        }

        emailIntent.putParcelableArrayListExtra(android.content.Intent.EXTRA_STREAM, uris);
        startActivity(android.content.Intent.createChooser(emailIntent, "Send mail..."));
final Intent emailIntent=新意图(android.content.Intent.ACTION\u SEND\u MULTIPLE);
emailIntent.setType(“jpeg/image”);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,SUBJECT);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,body);
ArrayList URI=新的ArrayList();
//从路径转换为Android友好的包裹Uri
对于(int i=0;i
第一部分

Intent sendIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sendIntent.setType("plain/text");
sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"abc@gmail.com"});
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Accident Capture");
sendIntent.putExtra(Intent.EXTRA_TEXT, emailBody);

ArrayList<Uri> uriList = getUriListForImages();
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriList);
Log.d(TAG, "Size of the ArrayList :: " +uriList.size());
FormHolderActivity.this.startActivity(Intent.createChooser(sendIntent, "Email:"));
Intent sendIntent=新意图(Intent.ACTION\u SEND\u MULTIPLE);
sendIntent.setType(“纯/文本”);
sendIntent.putExtra(Intent.EXTRA_电子邮件,新字符串[]{”abc@gmail.com"});
sendIntent.putExtra(Intent.EXTRA_主题,“事故捕捉”);
sendIntent.putExtra(Intent.EXTRA_TEXT,emailBody);
ArrayList uriList=getUriListForImages();
sendIntent.putParcelableArrayListExtra(Intent.EXTRA\u流,uriList);
Log.d(标记“ArrayList的大小::”+uriList.Size());
FormHolderActivity.this.startActivity(Intent.createChooser(sendIntent,“Email:”);
------------------GetUriListForImages--------------------------------

private ArrayList<Uri> getUriListForImages() throws Exception {
            ArrayList<Uri> myList = new ArrayList<Uri>();
            String imageDirectoryPath = Environment.getExternalStorageDirectory().getAbsolutePath()+ "/folder/";
            File imageDirectory = new File(imageDirectoryPath);
            String[] fileList = imageDirectory.list();
            if(fileList.length != 0) {
                for(int i=0; i<fileList.length; i++)
                {   
                    try 
                    {   
                        ContentValues values = new ContentValues(7);
                        values.put(Images.Media.TITLE, fileList[i]);
                        values.put(Images.Media.DISPLAY_NAME, fileList[i]);
                        values.put(Images.Media.DATE_TAKEN, new Date().getTime());
                        values.put(Images.Media.MIME_TYPE, "image/jpeg");
                        values.put(Images.ImageColumns.BUCKET_ID, imageDirectoryPath.hashCode());
                        values.put(Images.ImageColumns.BUCKET_DISPLAY_NAME, fileList[i]);
                        values.put("_data", imageDirectoryPath + fileList[i]);
                        ContentResolver contentResolver = getApplicationContext().getContentResolver();
                        Uri uri = contentResolver.insert(Images.Media.EXTERNAL_CONTENT_URI, values);
                        myList.add(uri);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
            return myList;
        } 
private ArrayList getUriListForImages()引发异常{
ArrayList myList=新的ArrayList();
字符串imageDirectoryPath=Environment.getExternalStorageDirectory().getAbsolutePath()+“/folder/”;
File imageDirectory=新文件(imageDirectoryPath);
String[]fileList=imageDirectory.list();
如果(fileList.length!=0){

对于(int i=0;我必须尝试将这些图像放在SD卡上,然后附加到电子邮件意图,看看会发生什么?我在资产文件夹中有图像。我想从资产文件夹发送图像。这些图像对于android电子邮件应用程序可能是不可读的,因为它位于资产目录中,并且资产对于android应用程序是私有的。我的问题是否有其他解决方案em?以“世界可读”模式将图像从/asset复制到/data/data/目录,然后从该路径附加。。