Android上的电子邮件活动 [英] Email activity on Android

查看:83
本文介绍了Android上的电子邮件活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Android虚拟机向我的gmail帐户发送电子邮件。
问题:但是按下发送按钮时,我得到:

I want to send email from Android virtual machine to my gmail account. Problem: but on pressing send button I am getting:


没有应用程序可以执行此操作

"No application can perform this action"

这是我的代码:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("audio/mp3");
//sendIntent.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");
//sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/download/test.mp3")); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(GlobalVariable.getstrEmail())); 
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
startActivity(Intent.createChooser(sendIntent, "Title:"));


推荐答案

在真实设备上尝试,应该可以。并且您需要更改类型:

Try it on a real device itself, it should work. And you need to change the type:

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"email@example.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "body text");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));

这篇关于Android上的电子邮件活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆