1

I have found two threads on the same topic with no solution that I can use, I am looking to click on an email address and automatically open an email app and send email, my code seems fine to me but I get the "No apps can perform this action"

This is the method I am using;

 textView_emailid.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
                    textView_emailid.toString(), "your@email.com", null));
            intent.setType("text/plain");
            intent.putExtra(Intent.EXTRA_SUBJECT, "Book an Appointment");
            intent.putExtra(Intent.EXTRA_TEXT, "Hi " + name);
            startActivity(Intent.createChooser(intent, "Send Email"));
        }
    });
James Cosgrave
  • 45
  • 3
  • 10
  • What is the value of `textView_emailid.toString()`? If the answer is anything other than `mailto`, that would be one problem. – CommonsWare Aug 15 '16 at 21:41

1 Answers1

0

Change your intent.setType("text/plain") to intent.setType("message/rfc822").

Try the code snippet in this post directly without changing anything since it's the correct solution: https://stackoverflow.com/a/2197841/5250273

If you still get "No apps can perform this action", then your device does not have any email application (since it may be rooted?).

Community
  • 1
  • 1
Ugurcan Yildirim
  • 4,820
  • 2
  • 33
  • 65