我想通过eMail发送几个文件.我发现这个 Android多个电子邮件附件使用Intent,但它确实有效,我没有收到任何错误消息.它只是不附加文件(我也尝试只发送一个文件,但我得到了相同的结果).
我有没有监督过什么?你有什么建议吗?
private static void email (Context context, String emailTo, String emailCC,
String subject, String emailText, List<String> filePaths)
{
//need to "send multiple" to get more than one attachment
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("text/xml");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[]{emailTo});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailText);
//has to be an ArrayList
ArrayList<Uri> uris = new ArrayList<Uri>();
//convert from paths to Android friendly Parcelable Uri's
for (String file : filePaths)
{
File fileIn = new File(file);
// Uri u = Uri.fromFile(fileIn);
Uri …Run Code Online (Sandbox Code Playgroud)