可能重复:
How to attach audio file from SD card to E-Mail in Android?
我想附加来自SD卡的音频文件和来自资源/可绘制文件夹的图像。我想从SD卡中删除音频文件邮件成功发送到Receiver.Please有人帮我解决了这个问题谢谢你。
答案 0 :(得分:0)
试试音频:
private File file;
file = new File("audio file name/ path");
File filelocation = file ;
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("audio/mp4");
sharingIntent.putExtra(Intent.EXTRA_EMAIL, "xxxxxxxxxxxxxxx@gmail.com" );
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+filelocation.getAbsolutePath()));
startActivity(Intent.createChooser(sharingIntent, "Send email"));
尝试此图片:
private File file;
file = new File("your image path");
File filelocation = file ;
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("image/jpeg");
sharingIntent.putExtra(Intent.EXTRA_EMAIL, "XXXXXXXXX@gmail.com" );
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+filelocation.getAbsolutePath()));
startActivity(Intent.createChooser(sharingIntent, "Send email"));