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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:10:59+00:00 2026-05-26T11:10:59+00:00

I have Spinners that I am using in my application. They are working fine

  • 0

I have Spinners that I am using in my application. They are working fine with one exception. I have set prompts for each one, but they are not showing. I am setting ArrayAdapters to the Spinners during onCreate, and my guess is that the setAdapter method is automatically setting the selection to position 0. Is there a way to set the prompt and have it work as expected?

Here is a code piece:

From the layout file:

<Spinner android:id="@+id/selPunter"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:prompt="@string/select_quarterback_prompt"
         android:layout_marginLeft="20sp"
         android:layout_marginRight="20sp" />

From activity:

offenseList = new ArrayAdapter<PlayerVO>(this,
                                         R.layout.select_item_closed,
                                         gdm.getPlayersByTeamId(offenseId));
offenseList.setDropDownViewResource(R.layout.select_item);
selKicker.setAdapter(offenseList);
  • 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-26T11:11:00+00:00Added an answer on May 26, 2026 at 11:11 am

    This seems to happen even if you put the OnItemSelectedListener in the onStart() method of the activity.

    The work around I did for this issue was I put a default message in position 0 of my resource array (“Select Trip Type”). So when the OnItemSelectedListener is called, if position 0 is selected, then do nothing. Here is my code:

     mTripTypeSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    
            @Override
            public void onItemSelected(AdapterView<?> parent,View v,int position,long rowId) {
                //boolean used for hiding spinner
                boolean hideSpinner = true;
    
                switch(position){
                    case 0:
                        //nothing was selected - defualt "Select Trip Type"
                        hideSpinner = false;
                        break;
                    case 1:
                        mCurrentStop.setStopType(Stop.STOP_TYPE.DELIVERY);
                        break;
                    case 2:
                        mCurrentStop.setStopType(Stop.STOP_TYPE.START_OF_BREAK);
                        break;
                    case 3:
                        mCurrentStop.setStopType(Stop.STOP_TYPE.END_OF_BREAK);
                        break;
                    case 4:
                        mCurrentStop.setStopType(Stop.STOP_TYPE.START_OF_LUNCH);
                        break;
                    case 5:
                        mCurrentStop.setStopType(Stop.STOP_TYPE.END_OF_LUNCH);
                        break;
                    case 6:
                        mCurrentStop.setStopType(Stop.STOP_TYPE.END_OF_TRIP);
                        break;
                }
    
                //display other data screens
                displayData(hideSpinner);
            }
            @Override
            public void onNothingSelected(AdapterView<?> arg0) {
                mCurrentStop.setStopType(Stop.STOP_TYPE.DELIVERY);
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Ajax in my application. It is working fine in all the
I made one application that using the spinner in it. in my application client
I have an android spinner that's populated by a list of strings using an
I have been using the Graphview library, and its working great for my simple
I have created a drop down in my android application using a spinner. However
I have a Spinner that's populated using a cursor containing data from a database.
I have a spinner that is created using the resource file statically. now i
I have a spinner that displays when an ajax request is made using jquery:
In my Android application, I am using spinner, and I have loaded data from
This is driving me insane now. I have a loop that creates buttons. Each

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.