我正在尝试向邮件发送附有资产文件夹图像的邮件,邮件已成功发送,但是当我检查它时,邮件中没有附加图像,这是我的代码,
Uri uri = Uri.fromFile(new File("file:///android_asset/Hat_5.png"));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setType("image/png");
intent.putExtra(Intent.EXTRA_EMAIL , new String[] { "some@gmail.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "New Order");
intent.putExtra(Intent.EXTRA_TEXT , "Order Id :" +imageId);
intent.putExtra(Intent.EXTRA_STREAM , uri);
startActivity(Intent.createChooser(intent, "Send mail..."));
允许,
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />