【发布时间】:2016-07-06 21:44:57
【问题描述】:
我正在尝试发送带有附件的电子邮件。内部存储中的文件,所以这是我的代码:
File filelocation = new File(getFilesDir().getAbsolutePath()+"/MyApp", "FileName");
Uri path = Uri.fromFile(filelocation);
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent .setType("vnd.android.cursor.dir/email");
String to[] = {"mailmailmail@gmail.com"};
emailIntent .putExtra(Intent.EXTRA_EMAIL, to);
emailIntent .putExtra(Intent.EXTRA_STREAM, path);
emailIntent .putExtra(Intent.EXTRA_SUBJECT, "Subject");
startActivity(Intent.createChooser(emailIntent , "Send email..."));
但我总是得到:Permission denied for file。
我该如何解决??
【问题讨论】:
-
GMail 5.0 只接受来自外部存储的文件stackoverflow.com/questions/26883259/…
标签: java android file email storage