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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:32:22+00:00 2026-06-15T09:32:22+00:00

I want to implement two different spinner in Android, the spinner have different data

  • 0

I want to implement two different spinner in Android, the spinner have different data set

This is the spinner with the age, that uses a defined String array with all age ranges (es 18-20, 19-21 etc.)

 <Spinner
        android:id="@+id/spAge"
        android:layout_width="match_parent"
        android:layout_height="35dp"
        android:entries="@array/age_array" 
        tools:listitem="@android:layout/simple_spinner_item/>

And this is the spinner with the sex, that show only the two items Male and Female

 <Spinner
       android:id="@+id/spSex"
       android:layout_width="match_parent"
       android:layout_height="35dp"
       android:entries="@array/sex_array"
       tools:listitem="@android:layout/simple_spinner_item />

For each selected item the my activity should set the associated selected items values to the two Objects:

String selectedAge;
String selectedItem;

The sample that I have seen doesn’t contains multiple spinner with different items set and different actions on item selected, and I don’t know how to solve the problem.

  • 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-15T09:32:24+00:00Added an answer on June 15, 2026 at 9:32 am

    Try this

     ArrayAdapter<CharSequence> adapterAge; 
     ArrayAdapter<CharSequence> adapterSex;
    
     String[] AgeArr = {"18-20", "19-21"};
     String[] sexArr = {"male", "female"};
    
     Spinner ageDrp =(Spinner)findViewById(R.id.spAge);
     Spinner sex1Drp    =(Spinner)findViewById(R.id.spSex);
    
    adapterAge =    new ArrayAdapter<CharSequence>(this,android.R.layout.simple_spinner_item,AgeArr);
    adapterAge.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    ageDrp.setAdapter(adapterAge);
    
    adapterSex=     new ArrayAdapter<CharSequence>(this,android.R.layout.simple_spinner_item,sexArr);
    adapterSex.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    sexDrp.setAdapter(adapterSex);
    
    String selectedAge  = ageDrp.getSelectedItem().toString();
    String selectedSex  = sexDrp.getSelectedItem().toString();
    System.out.println(selectedAge+" "+selectedSex);// check the output in logcat
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement two different dictionaries with a predefined set of valid keys.
I have a class that instantiates two classes which implement interfaces. I want one
i need to implement this scenario Brief about that is have two java based
i starter in jqgrid, i want implement inline edit in jqgrid i have this
I just want to know that is it possible to communicate two different apps
I have a database where I store two different kinds of data. One table
Basically, I want a class to be able to implement two different versions of
Lets say that I have two different types of RelativeLayouts. That is to say
I am trying to implement this great technique of sharing preferences across two different
I want to implement my app in both landscape and portrait with two different

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.