当我发送电子邮件时,收件箱中显示文件附件 0 字节。我的代码如下。如何解决这个问题呢?提前谢谢你。
String path = "/data/data/"
+ context.getApplicationContext().getPackageName()
+ "/files/";
String filename= "save.ime";
Intent mSendIntent = new Intent(
android.content.Intent.ACTION_SEND);
mSendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mSendIntent.setType("plain/text");
mSendIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { "" });
mSendIntent.putExtra(android.content.Intent.EXTRA_CC, "");
mSendIntent.putExtra(android.content.Intent.EXTRA_BCC, "");
mSendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"InfoMe Profile Request");
mSendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new
File(path+filename)));
mSendIntent.putExtra(android.content.Intent.EXTRA_TEXT,
Function.bodypart);
context.startActivity(Intent.createChooser(
mSendIntent, "Send mail..."));