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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:47:35+00:00 2026-05-25T15:47:35+00:00

I wanted to ask how can one use both spinner and button on the

  • 0

I wanted to ask how can one use both spinner and button on the same activity. Spinner listens with its onItemListener and then the button would have an onClick listener too. So in my case, it generates an error. My scenario is that I get the selected string from the spinner and then the rest of the values from editTexts and then hit “submit” to send data to the server. But I reckon these two listeners aren’t very friendly with each other?

I set up these methods for the spinner right:

spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
        // your code here
    }

    @Override
    public void onNothingSelected(AdapterView<?> parentView) {
        // your code here
    }
});

Then I need to put the onclick listener for the button:

go.setOnClickListener(new OnClickListener(){
    public void onClick(View arg0)
    {
    }

Where do I put this one? Before the nothingSelected method or after that?

  • 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-25T15:47:35+00:00Added an answer on May 25, 2026 at 3:47 pm

    I think they are very friendly with each other 🙂

        spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
                // your code here
            }
    
            @Override
            public void onNothingSelected(AdapterView<?> parentView) {
                // your code here
            }
    
        });
    
        go.setOnClickListener(new OnClickListener() {
    
           @Override
           public void onClick(View arg0) {       
              // your code here                
           }
       });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still new to the API and I wanted to ask: Can you send
I wanted to ask how i can create a good swipe animation when switching
I wanted to ask Stack Overflow users for a nice idea for a project
I wanted to ask whether the following statement where printf() has been provided with
I wanted to ask what is the idea behind the fact that System.String doesn't
The question I always wanted to ask and was afraid to, actually - what
Update2: What I really wanted to ask was already argued in a different page.
I'm a jquery newbie - wanted to ask what might be the best strategy
I have a block of code that works and I wanted to ask what
We are having some performance issues with a page and I wanted to ask

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.