• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps how to get multiple extra text in email form android

Hi all

I need to get multiple values to an email form, however when i use the EXTRA_TEXT the system only displays the last value. Can anyone help? My code can be seen below.

public void email(View button){
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
startActivity(emailIntent);
startActivity(Intent.createChooser(emailIntent, "Send your email in:"));

String aEmailList[] = { "property@venns.co.za"};

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Property Query: ");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Full Name:");
emailIntent.setType("plain/text");
//emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Query and Telephone Number: ");
EditText num1 = (EditText) findViewById(R.id.num1);
String message = num1.getText().toString();
EditText num2 = (EditText) findViewById(R.id.num2);
String message1 = num2.getText().toString();
EditText num3 = (EditText) findViewById(R.id.num3);
String message2 = num3.getText().toString();
EditText num4 = (EditText) findViewById(R.id.num4);
String message3 = num4.getText().toString();
emailIntent.putExtra(EXTRA_TEXT, message);
startActivity(emailIntent);
}
 
So, using the code above, how about this?

Code:
StringBuilder sb = new StringBuilder();
EditText num1 = (EditText) findViewById(R.id.num1);
sb.append(num1.getText().toString());
EditText num2 = (EditText) findViewById(R.id.num2);
sp.append(" ").append(num2.getText().toString());
EditText num3 = (EditText) findViewById(R.id.num3);
sb.append(" ").append(num3.getText().toString());
EditText num4 = (EditText) findViewById(R.id.num4);
sb.append(" ").append(num4.getText().toString());
emailIntent.putExtra(EXTRA_TEXT, sb.toString());
startActivity(emailIntent);
 
Upvote 0
So, using the code above, how about this?

Code:
StringBuilder sb = new StringBuilder();
EditText num1 = (EditText) findViewById(R.id.num1);
sb.append(num1.getText().toString());
EditText num2 = (EditText) findViewById(R.id.num2);
sp.append(" ").append(num2.getText().toString());
EditText num3 = (EditText) findViewById(R.id.num3);
sb.append(" ").append(num3.getText().toString());
EditText num4 = (EditText) findViewById(R.id.num4);
sb.append(" ").append(num4.getText().toString());
emailIntent.putExtra(EXTRA_TEXT, sb.toString());
startActivity(emailIntent);
Thank you so much, your code works perfectly, when i doing it i was not appending the code properly.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones