Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8315611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:10:16+00:00 2026-06-08T21:10:16+00:00

I am trying to have more than one Edittext fields to send via a

  • 0

I am trying to have more than one Edittext fields to send via a intent to email.

the code will make more sense of what i am trying to accomplish,

public class EmailSupport extends Activity {

  Button buttonSend;
  String textTo;
  EditText textSubject;
  EditText nametext;
  EditText emailtext;
  EditText phonetext;
  EditText topictext;
  EditText detailstext;


@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.email_form_to_support);

        public void onClick(View v) {
        String[] recipients = new String[]{"email@email.com", "email@email.com",};
          String subject = textSubject.getText().toString();
          String name = nametext.getText().toString();
          String emails = emailtext.getText().toString();
          String phone = phonetext.getText().toString();
          String topic = topictext.getText().toString();
          String details = detailstext.getText().toString();


          Intent email = new Intent(Intent.ACTION_SEND);
          email.putExtra(android.content.Intent.EXTRA_EMAIL, recipients);
          email.putExtra(Intent.EXTRA_SUBJECT, subject);
          email.putExtra(Intent.EXTRA_TEXT, name);
          email.putExtra(Intent.EXTRA_TEXT, emails);
          email.putExtra(Intent.EXTRA_TEXT, phone);
          email.putExtra(Intent.EXTRA_TEXT, topic);
          email.putExtra(Intent.EXTRA_TEXT, details);

I need to know how to incorporate all the edittext inputs as see in the layout file below to basic add to the message text in the email. my topic edittext is my subject for the email and i want to hardline a email address to send it too by default.

email_form_to_support.xml

  <?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/name" />


    <EditText
        android:id="@+id/nametext"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/email"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/email" />



    <EditText
        android:id="@+id/emailtext"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:minLines="1"
        android:scrollbars="vertical" />

<TextView
    android:id="@+id/phone"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/phone" />


    <EditText
        android:id="@+id/phonetext"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:maxLines="8"
        android:minLines="1"
        android:scrollbars="vertical" />

    <TextView
        android:id="@+id/topic"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/topic" />


    <EditText
        android:id="@+id/topictext"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:maxLines="3"
        android:minLines="1"
        android:scrollbars="vertical" />

    <TextView
        android:id="@+id/details"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/details" />


    <EditText
        android:id="@+id/detailstext"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:maxLines="8"
        android:minLines="1"
        android:scrollbars="vertical" />


    <Button
        android:id="@+id/submit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/submit" />

</LinearLayout>

Any help would be appreciate. I feel like im just missing something simple however i may be wrong. So far with this method of source i am getting errors on the String message = xxxtext.getText().toString(); because i have it several time. I dont know what to put for each one.

Per Pavel Dudka recommended I change my Source to This

 public class EmailSupport extends Activity {

Button buttonSend;
String textTo;
EditText textSubject;
EditText nametext;
EditText emailtext;
EditText phonetext;
EditText topictext;
EditText detailstext;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.email_form_to_support);

    buttonSend = (Button) findViewById(R.id.submit);
    textTo = (String) getString(R.string.to);
    textSubject = (EditText) findViewById(R.id.topictext);
    nametext = (EditText) findViewById(R.id.nametext);
    emailtext = (EditText) findViewById(R.id.emailtext);
    phonetext = (EditText) findViewById(R.id.phonetext);
    topictext = (EditText) findViewById(R.id.topictext);
    detailstext = (EditText) findViewById(R.id.detailstext);

    buttonSend.setOnClickListener(new OnClickListener() {



        public void onClick(View v) {

            StringBuilder emailBodyBuilder = new StringBuilder();

            emailBodyBuilder.append(textSubject.getText().toString());
            emailBodyBuilder.append("\n");
            emailBodyBuilder.append(nametext.getText().toString());
            emailBodyBuilder.append("\n");
            emailBodyBuilder.append(emailtext.getText().toString());
            emailBodyBuilder.append("\n");
            emailBodyBuilder.append(topictext.getText().toString());
            emailBodyBuilder.append("\n");
            emailBodyBuilder.append(phonetext.getText().toString());
            emailBodyBuilder.append("\n");
            emailBodyBuilder.append(detailstext.getText().toString());

            final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("plain/text");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new  String[]{"email1@domen.com", "email2@domen.com"});
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, textSubject.getText().toString());
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailBodyBuilder.toString());
            startActivity(Intent.createChooser(emailIntent, "Send mail..."));
        }
    });
}   

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:10:18+00:00Added an answer on June 8, 2026 at 9:10 pm

    I’m not certain what you are trying to accomplish but change this:

        public void onClick(View v) {
        String[] recipients = new String[]{"email@email.com", "",};
          String subject = textSubject.getText().toString();
          String message = nametext.getText().toString();
          String message = textMessage.getText().toString();
          String message = textMessage.getText().toString();
          String message = textMessage.getText().toString();
    

    to this:

    public void onClick(View v) {
        String[] recipients = new String[]{"email@email.com", "email2@email.com"};
        String subject = textSubject.getText().toString();
        String name = nametext.getText().toString();
        String email = emailtext.getText().toString();
        String phone = phonetext.getText().toString();
        String topics = topicstext.getText().toString();
        String details = deatilstext.getText().toString();
    
        // Do something with this Strings
    }
    

    Here each EditText is stored in it’s own String, for you to use as you please.

    Addition from comments

    Simply combine the Strings, this is one easy way:

    String message = nametext.getText().toString();
    message += "\n" + emailtext.getText().toString();
    etc.
    

    Where a “\n” is a line break like using Enter. You can setup a more interesting format between the fields, perhaps:

    message += "\n\nEmail:\n" + emailtext.getText().toString();
    

    But that is up to you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a part of my code more fluent. I have a
I'm trying to understand how to have more than one series on a plot,
I am trying to have a LocatorPane with more than one Locator using LocatorAutoCreate
Trying to have more than one popup calendar in a component I'm building but
I have one question, I was trying to find more information on the internet
I have a 3 column layout, and am trying to make it more responsive
I have been messing around with my meta descriptions, trying to make them more
I'm trying to get SBT to build a project that could have more than
Trying to get a bit more out of the command line: I have a
I have a Javascript Highchart that I'm displaying and trying to get more information

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.