Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add new line to email contents?

Tags:

android

email

I want to Place content like

  1. Name
  2. Pass
  3. Email

to the email content. how to do this...?

I tried this but not working.

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "First Name : "         + fname.getText().toString());
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Last Name : "                  + lname.getText().toString());
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Email : "                  + email.getText().toString());

Thanks in advance..!

like image 933
Noby Avatar asked Dec 09 '22 04:12

Noby


1 Answers

Why not use a StringBuilder to create all your content and then add it to your intent ?

StringBuilder sb;

sb.append("First Name : ");
sb.append(fname.getText().toString());
sb.append('\n');
sb.append("Last Name : ");
sb.append(lname.getText().toString());
sb.append('\n');
sb.append("Email : ");
sb.append(email.getText().toString());

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,sb);
like image 137
Ramseys Avatar answered Dec 21 '22 11:12

Ramseys