重複の可能性:
Androidで添付ファイル付きのメールを送信する方法は?
電子メールを送信すると、受信トレイに添付ファイル 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..."));