我正在创建一个应用程序来发送邮件。我正在使用扩展 phoneStateListener 类的类。这在 startActivity 函数时给出了问题,它表示“方法 startActivity(Intent) 未定义为 PhoneCallListener 类型”,其中 PhoneCallListener 是由 phonestatelistener 扩展的类,并且将以下代码写入其中。
String to = "a.crack@gmail.com";
String subject = "testing";
String message = "this is it";
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{ to});
email.putExtra(Intent.EXTRA_SUBJECT, subject);
email.putExtra(Intent.EXTRA_TEXT, message);
//need this to prompts email client only
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Choose an Email client :"));
请帮助我如何开始活动以发送我的邮件。