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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:00:14+00:00 2026-05-27T10:00:14+00:00

Possible Duplicate: Is it possible to have a spinner and a list view on

  • 0

Possible Duplicate:
Is it possible to have a spinner and a list view on the same page?

I want to have a spinner at the top of view, and then generate a list view below the spinner according to what the user has selected from the spinner, does anyone know a good tutorial for this or have some code lying around that might help?

I have had success using a ListView by extending ListActivity, but in this case I want to have things other than the ListView in the view, so I am not sure what to do?

  • 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-27T10:00:15+00:00Added an answer on May 27, 2026 at 10:00 am

    First you can create layout for your activity, for example (layout_with_spinner):

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent"  
        android:orientation="vertical"  
        android:id="@+id/layout1">
        <LinearLayout   
            android:orientation="horizontal" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content">
            <TextView 
                android:layout_width="40dip"
                android:layout_height="wrap_content"
                android:text="some text"/>
            <Spinner 
                android:layout_width="150dip"
                android:layout_height="fill_parent"                                  
                android:id="@+id/spinner1" />                         
    
        </LinearLayout>
        <ListView 
            android:id="@+id/list_view" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content">
        </ListView>         
    </LinearLayout>
    

    and then you can create class extended from Activity

    public class YourCoolActivity extends Activity
    {
        private Spinner mSpinner;
        private ListView mList;             
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);     
            setContentView(R.layout.layout_with_spinner);
                mSpinner= (Spinner)findViewById(R.id.spinner1);
                mList = (ListView)findViewById(R.id.list_view); 
                //here create some adapter. 
                mSpinner.setAdapter(yourAdapter);
                //set listener on select
                mSpinner.setOnItemSelectedListener(new OnItemSelectedListener()     
        {
            @Override
            public void onItemSelected(AdapterView<?> parent, View view,
                    int pos, long id)
            {                           
                             //here you can populate list with data
                             //create new list adapter depended on  (YourObjectModel)mSpinner.getSelectedItem()
                            // or pos
                             mList.setAdapter(newListAdapter);
    
            }
    
            @Override
            public void onNothingSelected(AdapterView<?> arg0)
            {           
            }           
        }); 
    
        }
    }
    

    Maybe it helps to start. You can look at this
    sample to look at some sample about spinners

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

Sidebar

Related Questions

Possible Duplicate: GridView current page I have a GridView ,I enabled Paging. I want
Possible Duplicate: Java - Regex problem I have list of URLs of types: http://www.example.com/pk/etc
Possible Duplicate: Is it possible to have an indexed view in MySQL? Possible duplicate:
Possible Duplicate: Java Ordered Map I have list of product object in the HashMap<Integer,Product>
Possible Duplicate: Embarcadero D2010 hide welcome page I have Delphi 2010. How do I
Possible Duplicate: make drop down list item unselectable I have an asp.net dropdownlist and
Possible Duplicate: Android Spinner OnItemSelected Called Erroneously (without user action on opening spinner) Does
Possible Duplicate: I have a problem with IFrame . Now i am using iframe.attribute(src)=..Pages/page.aspx....In
Possible Duplicate: PHP page redirect I have 0 experience with PHP. I was setting
Possible Duplicate: Simplified Collection initialization I have the string values, I just want to

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.