Kus*_*hal 17 android android-intent google-inbox
我将TEXT文件附加到电子邮件中,代码如下:
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto",
"abc@gmail.com", null));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Report");
emailIntent.putExtra(Intent.EXTRA_TEXT, prepareBodyMail());
File root = Environment.getExternalStorageDirectory();
File file = new File(root, "/MyFolder/report.txt");
Uri uri = Uri.fromFile(file);
emailIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(emailIntent, "Pick an Email provider"));
Run Code Online (Sandbox Code Playgroud)
此代码与Gmail,电子邮件和其他应用程序完美配合
但这并不是谷歌附带INBOX应用程序的文件
只有身体和主体没有任何依恋
任何人都能帮助我在代码中缺少什么吗?
小智 0
String fileLocation = Environment.getExternalStorageDirectory() + "/MyFolder/report.txt";
String to[] = {"abc@gmail.com"};
Intent intentEmail = new Intent(Intent.ACTION_SEND);
intentEmail.setType("vnd.android.cursor.dir/email");
intentEmail.putExtra(Intent.EXTRA_EMAIL, to);
intentEmail.putExtra(Intent.EXTRA_STREAM, fileLocation);
intentEmail.putExtra(Intent.EXTRA_SUBJECT, "Subject");
startActivity(Intent.createChooser(intentEmail , "Pick an Email provider"));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
947 次 |
| 最近记录: |