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

The Archive Base Latest Questions

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

So I have a spinner (spinner2 here) which is populated via an ArrayAdapter from

  • 0

So I have a spinner (spinner2 here) which is populated via an ArrayAdapter from an SQLite table. On selecting an item I want it

  • deleted from the DB
  • deleted from the spinner

The code below actually works. Except when the spinner has only one item. When that happens
it seems onItemSelected is not called at all.

I get the following LogCat

10-01 22:30:55.895: WARN/InputManagerService(1143): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@45a06028

Oh and when two items are populating the spinner, spinner.getcount() shows two items, so it’s not some strange case of the system thinking the spinner is empty or something like that.

This is the code:

public class SpinnerItemSelectListener implements OnItemSelectedListener {

        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            if(parent == spinner2){
                if(autoselected){
                    autoselected=false;
                }
                else{
                    //uniqvalarray is the arraymade from pulling data from SQLite and populaitng array adapter
                    Integer i = uniquevalarray.get(pos);
                    deleteRow(i);//deletes the row from the database and repopulates the above array.
                    autoselected=true;//just a boolean to stop autoslecting in onCreate()
                    //makeAlert(i);initially wanted to make alert box.
                    loadSpinner2();//reloads the spinner with new data


                }

            }



        }

        public void onNothingSelected(AdapterView parent) {
            //TODO
        }
    }
  • 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-25T22:37:48+00:00Added an answer on May 25, 2026 at 10:37 pm

    The spinner runs this way : Only fire when you change the selected item . If you dont change that element , cause its the only one that exist , it can’t change .

    The solution i think you must use is using a button next to the spinner to throw the delete funcions.

    You must think that Spinner is not made to be with an unique element , cause only changes usually when you change the selected one . then the natural solution can be that .

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

Sidebar

Related Questions

Here's the setup. I have a spinner, and each item in the spinner is
I am developing an android app in which I have 3 spinners populated from
I have a spinner. Now I want to compare the variable from the spinner
I have a UITableView which from an external RSS feed. When you select a
I got a Spinner element which I populate with data from a Cursor using
OK here is my problem. I have a spinner and every option in spinner
I am wanting to create a Spinner from an ArrayList of Objects I have
i have created a spinner.could i place my spinner items in a table into
I have implemented button which clicks and opens dialog with spinner inside as described
I have a partial which returns results from the Amazon-ecs API (searches for books).

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.