多个照片不发送使用意向的Gmail [英] Multiple Photo not sending to gmail using Intent

查看:129
本文介绍了多个照片不发送使用意向的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 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);

这篇关于多个照片不发送使用意向的Gmail的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆