直接贴代码:

Intent intent = new Intent(android.content.Intent.ACTION_SEND);// 附件File file = new File(Environment.getExternalStorageDirectory().getPath()+ File.separator + "simplenote"+ File.separator+"note.xml");// 收件人intent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[] {"pop1030123@163.com"});// 主题intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "note.xml");// 正文intent.putExtra(android.content.Intent.EXTRA_TEXT,"this is test extra.");intent.setType("application/octet-stream");//当无法确认发送类型的时候使用如下语句//intent.setType(“*/*”);//当没有附件,纯文本发送时使用如下语句//intent.setType(“plain/text”);intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));NoteActivity.mNext_tab = NoteActivity.NOTE_SETTING;startActivity(Intent.createChooser(intent, "Mail Chooser"));

另外的参考代码:

//系统邮件系统的动作为android.content.Intent.ACTION_SENDIntent email = new Intent(android.content.Intent.ACTION_SEND);email.setType("text/plain");emailReciver = new String[]{"pop1030123@163.com", "fulon@163.com"};emailSubject = "你有一条短信";emailBody = sb.toString();//设置邮件默认地址email.putExtra(android.content.Intent.EXTRA_EMAIL, emailReciver);//设置邮件默认标题email.putExtra(android.content.Intent.EXTRA_SUBJECT, emailSubject);//设置要默认发送的内容email.putExtra(android.content.Intent.EXTRA_TEXT, emailBody);//调用系统的邮件系统startActivity(Intent.createChooser(email, "请选择邮件发送软件"));

更多相关文章

  1. android EditText设置不可写
  2. android“设置”里的版本号
  3. android studio Could not find com.android.support.constraint
  4. 在Fragment中设置控件点击方法,执行失败。
  5. Android(安卓)闹钟管理类的使用
  6. Android(安卓)给 app默认权限(不弹窗申请权限)
  7. Android设置通知栏/状态栏透明改变通知栏颜色和app最上部分颜色
  8. [RK3399][Android7.1.1] WifiAp:开机默认打开wifi热点
  9. android 设置中划线 下划线等

随机推荐

  1. Android(安卓)GridView+listener
  2. 说说Android桌面(Launcher应用)背后的故
  3. [置顶] Android(安卓)命名规范 (提高代码
  4. 详解Android(安卓)Surface系统
  5. getSupportActionBar使用报错
  6. BigInteger类的使用方法
  7. Android(安卓)NFC API Reference中英文
  8. Android基站定位原理及实现代码
  9. ProgressView
  10. android 判断当前所否为锁屏界面