i am creating an application to send mail. I am using the class which extends the phoneStateListener class. this gives the problem at the time of startActivity function which says that “The method startActivity(Intent) is undefined for the type PhoneCallListener” where PhoneCallListener is a class extended by phonestatelistener and following code is written into it.
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 :"));
please help me with how to start the activity so as to send my mail.
Make sure that you add receiver in menifest file.