是这样的,已经获取了文件所在的位置,例如“/sdcard/a.doc”这个位置,
file是要如何定义这个地址的位置?
下面的是我网上找到的代码,file里面的参数是什么含义?
Intent email = new Intent(android.content.Intent.ACTION_SEND);
// 附件
File file = new File(Environment.getExternalStorageDirectory().getPath()+ File.separator + "simplenote"+ File.separator+"note.xml");
//邮件发送类型:带附件的邮件
email.setType("application/octet-stream");
//邮件接收者(数组,可以是多位接收者)
String[] emailReciver = new String[]{"123@qq.com","456@163.com"};
String emailTitle = "标题";
String emailContent = "内容";
//设置邮件地址
email.putExtra(android.content.Intent.EXTRA_EMAIL, emailReciver);
//设置邮件标题
email.putExtra(android.content.Intent.EXTRA_SUBJECT, emailTitle);
//设置发送的内容
email.putExtra(android.content.Intent.EXTRA_TEXT, emailContent);
//附件
email.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
//调用系统的邮件系统
startActivity(Intent.createChooser(email, "请选择邮件发送软件"));