我通过我的申请发送邮件.为此,我使用以下代码.
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT , "body of email");
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
Run Code Online (Sandbox Code Playgroud)
它只是工作正常,但我想附加一个xml文件.可能吗?怎么样?
| 归档时间: |
|
| 查看次数: |
17774 次 |
| 最近记录: |