我正试着在我的主要活动中开始一项活动。我正在尝试通过电子邮件发送数据。但是当我运行代码时,我的程序崩溃了。下面是我开始新活动的代码
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/html");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"aaa@gmail.com","ssss@yahoo.com"});
intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml("my html text goes here"));
startActivity(intent);发布于 2011-04-08 15:12:28
尝试使用Intent.createChooser方法查找应该发送邮件的应用程序,如下所示:
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType(EMAIL_CONTENT_TYPE);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"aaa@gmail.com","ssss@yahoo.com"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml("my html text goes here"));
Intent chooser = Intent.createChooser(emailIntent, "Choose the application to send the email");
startActivity(chooser);https://stackoverflow.com/questions/5591267
复制相似问题