/ / Android: Dlaczego ta wiadomość e-mail nie wypełnia pola odbiorcy? - Android, e-mail, Android-intent

Android: Dlaczego ta funkcja przesyłania wiadomości e-mail nie wypełnia pola odbiorcy? - Android, e-mail, intencja Androida

Próbuję wysłać wiadomość e-mail przez zamiar i wstępnie wypełnić pole odbiorcy standardowej aktywności e-mail. Jednak pole odbiornika nie jest wypełnione.

Mój kod:

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..."));
}

Odpowiedzi:

0 dla odpowiedzi № 1

Sprawdź, czy faktycznie otrzymujesz tekst z „getEditTextNotiz (). GetText (). ToString ()”.

Możesz także zmienić ten wiersz:

Intent emailIntent = new Intent(Intent.ACTION_SEND);

do

Intent emailIntent = new Intent("android.intent.action.SEND");