I have a query I am creating a intent
to send in email with a pdf attached but when the gmail is launched, everything is set correctly except the destination email field.
My code is the following for Intent
:
String s = mEmailCliente;
String[] mailto = new String[1];
mailto[0]=s;
Uri uri = Uri.fromFile(new File(String.valueOf(pdfFile)));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setData(Uri.parse("mailto:")); // only email apps should handle this
intent.putExtra(Intent.EXTRA_SUBJECT, "Su Factura");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "Buenas estimad@: a continuación se le adjunta su factura número F" + no_factura);
intent.setType("application/pdf");
intent.putExtra(Intent.EXTRA_EMAIL, mailto);
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Compartir vía: "));
Someone has an idea because it does not take the value of the variable called s
, however if the array mailto
specified a mail in quotes this if it takes it correctly. Greetings