i trying send email intent , prepopulate receiver field of standard email activity. however, receiver field not populated.
my code:
private void sendemail(){ if(getedittextemail().gettext().tostring().length() == 0){ final alertdialog.builder builder = new alertdialog.builder(getactivity()); builder.setmessage(r.string.bitte_email_eingeben).setcancelable(false); builder.setnegativebutton(r.string.ok, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { // user clicked ok button dialog.cancel(); } }); builder.show(); return; } intent emailintent = new intent(intent.action_send); emailintent.settype("vnd.android.cursor.dir/email"); string[] emailaddresses = new string[]{getedittextnotiz().gettext().tostring()}; emailintent.putextra(intent.extra_email, emailaddresses); startactivity(intent.createchooser(emailintent, "sende email...")); }
check getting text "getedittextnotiz().gettext().tostring()".
also, can change line:
intent emailintent = new intent(intent.action_send); to
intent emailintent = new intent("android.intent.action.send");
Comments
Post a Comment