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

  • SEARCH
  • Home
  • 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 8021705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:03:56+00:00 2026-06-04T22:03:56+00:00

I am creating an app that has a suggestion box. When the user inputs

  • 0

I am creating an app that has a suggestion box. When the user inputs information into edit texts, the information is retrieved an put into a string value. The string is then put in the text of the email. However, when the email is sent, the text contains no values for the edit texts.

Here is my code:

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.suggestions);

        Spinner spinner = (Spinner) findViewById(R.id.emailArea);
        ArrayAdapter<CharSequence> adapter = ArrayAdapter
                .createFromResource(this, R.array.email_array,
                        android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);
        spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());

        Button send = (Button) findViewById(R.id.emailSendButton);
        EditText ettext = (EditText) findViewById(R.id.etEmailText);
        EditText returnAddress = (EditText) findViewById(R.id.etReturnAddress);

        String text = ettext.getText().toString();
        String returnAddressText = returnAddress.getText().toString();

        emailText =
                "\n\nArea in the Guide: " + area
                + "\n\nSuggestion or Comment: " + text + 
                "\n\nReturn Address: "+ returnAddressText;

        send.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {

                Intent emailIntent = new Intent(
                        android.content.Intent.ACTION_SEND);

                emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                        address);
                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
                        "Suggestions/Comments: Black Ops 2");
                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
                        emailText);
                emailIntent.setType("text/plain");

                startActivity(Intent.createChooser(emailIntent, "Send Mail"));
                finish();
            }

        });
    }

    private void showToast() {
        Toast.makeText(this, "Thank you. Your message has been sent.",
                Toast.LENGTH_SHORT).show();// TODO Auto-generated method stub

    }

    public class MyOnItemSelectedListener implements OnItemSelectedListener {

        public void onItemSelected(AdapterView<?> parent, View view, int pos,
                long id) {

            area = areas[pos];
        }

        public void onNothingSelected(AdapterView parent) {

        }
    }
}

However, no matter what is entered, I always get blank text and null for the spinner. Any suggestions?

  • 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-04T22:03:58+00:00Added an answer on June 4, 2026 at 10:03 pm

    Retrieve the EditText values inside the onClickListener and use that.

    EditText etText;
    EditText returnAddress;
    public void onCreate(Bundle savedInstanceState) {
        //....
        Button send = (Button) findViewById(R.id.emailSendButton);
        etText = (EditText) findViewById(R.id.etEmailText);
        returnAddress = (EditText) findViewById(R.id.etReturnAddress);
         send.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
    
                String text = etText.getText().toString();
                String returnAddressText = returnAddress.getText().toString();
    
                emailText =
                    "\n\nArea in the Guide: " + area
                    + "\n\nSuggestion or Comment: " + text + 
                    "\n\nReturn Address: "+ returnAddressText;
    
                Intent emailIntent = new Intent(
                        android.content.Intent.ACTION_SEND);
    
                emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                        address);
                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
                        "Suggestions/Comments: Black Ops 2");
                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
                        emailText);
                emailIntent.setType("text/plain");
    
                startActivity(Intent.createChooser(emailIntent, "Send Mail"));
                finish();
            }
    
        });
        //...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating (really, re-creating) an app that has existing user and other data in
The app I am creating has lots of pictures that the user will be
I am creating an app that has three tabs on the main screen. Each
I'm creating a MonoTouch app that has some declarative business logic that the client
I am creating a custom membership provider for a web app that already has
I'm creating an app that has a database using sqlite. On my app I've
How would one go about creating an ipad app that has a similar view
I'm creating an app that has a slider at the bottom of a view
I'm creating iOS app that has a label. I want to set two colors.
I'm creating an app that has a UITableView. The data will be comming from

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.