Issue
I need to provide feature for users where users can share some data by sending email. I used below code.
Intent email = new Intent(android.content.Intent.ACTION_SENDTO);
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_EMAIL, new String[] { to });
email.putExtra(Intent.EXTRA_SUBJECT, subject);
email.putExtra(Intent.EXTRA_TEXT, message);
startActivity(Intent.createChooser(email,"Choose an Email client :"));
This shows Email, gmail, Skype and send via bluetooth for user to choose. I dont want user to show Skype,send via bluetooth in this list. What i need to do ? I have WhatsApp in my phone, which does same thing, but doesn't show Email, bluetooth in the list(Settings->help->Contactus->...).only show Email and Gmail in list. I need to do the same.
Solution
Try this:
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto","[email protected]", null));
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putExtra(Intent.EXTRA_TEXT, message);
startActivity(Intent.createChooser(intent, "Choose an Email client :"));
If you don't have a specific recipient - go like this:
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto", "", null));
Answered By - localhost
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.