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 6061991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:00:00+00:00 2026-05-23T09:00:00+00:00

I want to have EditText object appear when a the User chooses Combination on

  • 0

I want to have EditText object appear when a the User chooses “Combination” on a Spinner, How would I do this?

Here is what I have been trying:

     ground = (Spinner) findViewById(R.id.ground);
    ArrayAdapter<CharSequence> groundAdapter = ArrayAdapter.createFromResource(
            this, R.array.ground_array, android.R.layout.simple_spinner_item);
    groundAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    ground.setAdapter(groundAdapter);
    ground.setOnItemSelectedListener(new GroundListener());
    if(ground.getSelectedItem().toString().equalsIgnoreCase("Combination"))
    {
        combo.setVisibility(0);
    }

the EditText object combo is set in xml file as android:visibility="gone"

GroundListener Code is

     public class GroundListener implements OnItemSelectedListener {

            public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
                String selected = parent.getItemAtPosition(pos).toString();
            }

            public void onNothingSelected(AdapterView parent)
            {
                // Do nothing.
            }
        }
  • 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-05-23T09:00:00+00:00Added an answer on May 23, 2026 at 9:00 am

    What is a GroundListener ?

    Shouldn’t you be using an AdapterView.OnItemSelectedListener with its onItemSelected method ?

    Beside, use setVisibility(View.VISIBLE) instead of 0 for readability.

    EDIT:

    I don’t understand what you are doing with your code, your GroundListener is not plugged to anything and your test is outside of the listener.

    Try :

    ground.setOnItemSelectedListener(new OnItemSelectedListener() {
    
            public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
    
               if(parent.getItemAtPosition(pos).toString().equalsIgnoreCase("Combination"))
                {
                  combo.setVisibility(View.VISIBLE);
                }
            }
    
            public void onNothingSelected(AdapterView parent)
            {
                // Do nothing.
            }
        });
    

    Check if that works and then bring back the code in your GroundListener to see if it works. You might have a problem though with the fact that the GroundListener might not know what is combo. But you’ll work that out.

    Edit:

    Syntax Correction

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

Sidebar

Related Questions

i have a EditText in android in which i want the user to enter
I want to have some layout a bit like this [text tabel][edittext] i cant
I have an EditText textBox and I would like to react to the user
I have an EditText and a spinner and I want to open the spinner
I have this EditText field inside of one activity, and I want it so
I have an EditText that shows time. After user clicks the EditText I want
I have an EditText. I want that after typing some text, when user presses
I want to have a text box that the user can type in that
I have inherited EditText class an made my custom class, MyEditText. and want to
In my xml i have an edittext element like this <EditText android:id=@+id/hrvalue android:layout_width=wrap_content android:layout_height=wrap_content

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.