我正在尝试发送带附件的电子邮件,但似乎错误了:
private void sendEmail(File pictureFile){
Uri uri = Uri.fromFile(pictureFile);
Date dt = new Date();
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL , new String[]{"a@gmail.com", "b@gmail.com"});
i.putExtra(Intent.EXTRA_SUBJECT, "Google Glass Capture");
i.putExtra(Intent.EXTRA_TEXT , "Taken "+ dt.toString());
i.putExtra(Intent.EXTRA_STREAM, uri);
try {
Log.d("Msg","Trying to send mail");
startActivity(Intent.createChooser(i,"pick"));
} catch (android.content.ActivityNotFoundException ex) {
Log.e("ERR","Error " + ex.toString());
Toast.makeText(MainActivity.this,
"There are no email clients installed.",
Toast.LENGTH_SHORT).show();
}
}
有没有不同的方式用谷歌玻璃发送邮件,然后用android发送邮件?