多个照片不发送使用意向的Gmail多个、意向、照片、Gmail

由网友(悸)分享简介:我是新来的Andr​​oid和尝试发送多个文件使用意向到Gmail。但其不发送附加的文件。请帮我的。I am new to android and trying to send the multiple files to gmail using the Intent. But its not sending the...

我是新来的Andr​​oid和尝试发送多个文件使用意向到Gmail。但其不发送附加的文件。请帮我的。

I am new to android and trying to send the multiple files to gmail using the Intent. But its not sending the attached files. Please help me for this.

下面是我的code:

Intent targetedShare = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
        targetedShare.setType("image/*"); // put here your mime type

        targetedShare.putExtra(Intent.EXTRA_SUBJECT, "Amplimesh Photo");
        targetedShare.putExtra(Intent.EXTRA_TEXT,"Attached the Quote");

        ArrayList<Uri> uris = new ArrayList<Uri>();

        //Fetching the Installed App and open the Gmail App.
        for(int index = 0; index < productList.size(); index++) {
            ByteArrayInputStream byteInputStream = new ByteArrayInputStream(productList.get(index).getOverlayBitmap());
            Bitmap overLayBitmap = BitmapFactory.decodeStream(byteInputStream);

            String fileName = SystemClock.currentThreadTimeMillis() + ".png";

            //Save the bitmap to cache.
            boolean isSaved = Helper.saveImageToExternalStorage(overLayBitmap, getApplicationContext(), fileName);
            if(isSaved)
                uris.add(Uri.fromFile(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/amplimesh", fileName)));
        }
        targetedShare.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        startActivityForResult(Intent.createChooser(targetedShare, "Sending multiple attachment"), 12345);

推荐答案

更新

尝试用这样的完整路径

try with full path like this 

使用

use this 

而不是

Intent share = new Intent(android.content.Intent.ACTION_SEND);

试试这个

 Intent ei = new Intent(Intent.ACTION_SEND_MULTIPLE);
            ei.setType("plain/text");
            ei.putExtra(Intent.EXTRA_EMAIL, new String[] {"email id"});
            ei.putExtra(Intent.EXTRA_SUBJECT, "That one works");

            ArrayList<String> fileList = new ArrayList<String>();
            fileList.add(Environment.getExternalStorageDirectory()+"/foldername/certi/qualifications.jpg");
            fileList.add(Environment.getExternalStorageDirectory()+"/foldername/certi/certificate.jpg");
            fileList.add(Environment.getExternalStorageDirectory()+"/foldername/Aa.pdf");

            ArrayList<Uri> uris = new ArrayList<Uri>();
            //convert from paths to Android friendly Parcelable Uri's

            for (int i=0;i<fileList.size();i++)
            {
                File fileIn = new File(fileList.get(i));
                Uri u = Uri.fromFile(fileIn);
                uris.add(u);
            }

            ei.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
            startActivityForResult(Intent.createChooser(ei, "Sending multiple attachment"), 12345);
阅读全文

相关推荐

最新文章