samedi 22 mai 2021

Checkbox data to Email

I've been struggling lately with this issue of transferred the checkbox data to the email. I have combined the edittext boxes so that by pressing submit, the data from all these editext's are transferred to the email. how do I include the checkboxes in intent.putExtra(Intent.EXTRA_TEXT? My code is as followes:

button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!editTextTextPersonName4.getText().toString().isEmpty() && !editTextTextPersonName5.getText().toString().isEmpty()
                    && !editTextTextPersonName6.getText().toString().isEmpty() && !editTextTextPersonName7.getText().toString().isEmpty()  && !editTextTextPersonName8.getText().toString().isEmpty()) {
                Intent intent = new Intent(Intent.ACTION_SENDTO);
                intent.setData(Uri.parse("mailto:")); // only email apps should handle this.
                intent.putExtra(Intent.EXTRA_EMAIL, "");
                intent.putExtra(Intent.EXTRA_SUBJECT, "Email for Mercedes Autoteile");
                intent.putExtra(Intent.EXTRA_TEXT, "Name: " + editTextTextPersonName4.getText().toString() + '\n' + "Surname: " + editTextTextPersonName5.getText().toString() + '\n' + "Email: " + editTextTextPersonName6.getText().toString() + '\n' + "Cellphone Number: "
                        + editTextTextPersonName7.getText().toString() + '\n' + "VIN Number: " + editTextTextPersonName8.getText().toString() + '\n' + "Non Listed Part(s): " + editTextTextPersonName.getText().toString());



Aucun commentaire:

Enregistrer un commentaire