Skip to content

Instantly share code, notes, and snippets.

@TakWolf
Created February 12, 2015 12:08
Show Gist options
  • Save TakWolf/963dc10418b206f58990 to your computer and use it in GitHub Desktop.
Save TakWolf/963dc10418b206f58990 to your computer and use it in GitHub Desktop.
//先跳转到邮件
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:[email protected]"));
//判断能否跳转
if (intent.resolveActivity(getPackageManager()) != null) { //可以接收
intent.putExtra(Intent.EXTRA_SUBJECT, "邮件标题");
intent.putExtra(Intent.EXTRA_TEXT, "邮件正文啦啦啦~");
startActivity(intent);
} else { //不能跳转
Toast.makeText(this, "没有安装邮件客户端", Toast.LENGTH_SHORT).show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment