android - Email intent always launch gmail by default -
string body="message"; intent emailintent = new intent(intent.action_send); emailintent.putextra(android.content.intent.extra_subject, "check out book reading"); emailintent.settype("plain/text"); emailintent.putextra(android.content.intent.extra_text, body); startactivity(intent.createchooser(emailintent, "send email...")); no matter (removing gmail accounts , signin hotmail account mail app), code launches gmail default , not show or let me choose universal mail app.
consequently, there no way let user send email via hotmail or other mail provider.
update: best piece of code ever come across, presents directly app chooser mail client present. answer below give huge list of apps choose irrelevant.
string mailto=""; intent email_intent = new intent(intent.action_sendto, uri.fromparts("mailto",mailto, null)); email_intent.putextra(android.content.intent.extra_subject, "subject text here"); email_intent.putextra(android.content.intent.extra_text,"body text here"); startactivity(intent.createchooser(email_intent, "send email..."));
try using correct mime type (text/plain) instead of invalid mime type (plain/text).
Comments
Post a Comment