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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:28:41+00:00 2026-06-10T11:28:41+00:00

Actually i got a value in server to create the spinner. i tried to

  • 0

Actually i got a value in server to create the spinner. i tried to set setOnClickListener for all spinners but it getting error.Refer my code below.

public static Spinner[] clickspin = new Spinner[nvalue];//nvalue = 2 (get from server)
for(int i=0;i<nvalue;i++)
{
clickspin[i]=new Spinner(this);
        clickspin[i].setLayoutParams(new TableRow.LayoutParams(90/*length of combo box*/, TableRow.LayoutParams.WRAP_CONTENT));
        clickspin[i].setAdapter(adapter1);
        clickspin[i].setId(i);
        clickspin[i].setClickable(true);
        clickspin[i].setOnClickListener(new OnClickListener() 
        {               
            public void onClick(View v) 
            {
                int n = v.getId();

            }
        });
}

how to set setOnClickListener for every spinner

  • 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-10T11:28:42+00:00Added an answer on June 10, 2026 at 11:28 am

    with Spinners, we use OnItemSelectedListener.

    clickspin[i].OnItemSelectedListener(new AdapterView.OnItemSelectedListener() {               
    
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
        // An item was selected. You can retrieve the selected item using
        // parent.getItemAtPosition(pos)
        }
    
        public void onNothingSelected(AdapterView<?> parent) {
        // Another interface callback
        }
    });
    

    See the Spinners guide.

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

Sidebar

Related Questions

I've got a queue (actually 3 different queues but I don't believe that will
Today I've got a stacktrace with a very strange error. Actually, I may be
I have searched various forums and links but havn't got anything helpful yet. Actually
I've got a TABLE that's actually being used for its intended purpose, to display
I got a question ;) Actually I want to use core-data in different threads.
Actually I am confronted with a Problem. I've got a .apk-File in one Package
I've got to develop a multi-language code generator in C#. Well actually the idea
I've got XML coming back from an Ajax.Request in Ajax.Response.responseXML . My XML actually
I've got an ASP document that 5 years old. Actually I'm working with PHP
I was actually going through the question 1636644 .. and got confused with this

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.