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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:49:15+00:00 2026-06-11T23:49:15+00:00

I use dropdown spinner with cursor adapter. It contains e.g 1 – 100 items.

  • 0

I use dropdown spinner with cursor adapter. It contains e.g 1 – 100 items.
I select e.g. item 50. Item is selected. Next time when I open spinner first visible row is item 50. How can I achieve that when I open spinner it will focus to first item/first visible item will be item 1?

I mean like autoscroll up in the list, so first visible item in dropdown is 1st one and not selected one.

  • 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-11T23:49:17+00:00Added an answer on June 11, 2026 at 11:49 pm

    You can make the Spinner do what you want by extending it and overriding the two methods that are responsible for setup/showing the list of values:

    public class CustomSpinnerSelection extends Spinner {
    
        private boolean mToggleFlag = true;
    
        public CustomSpinnerSelection(Context context, AttributeSet attrs,
                int defStyle, int mode) {
            super(context, attrs, defStyle, mode);
        }
    
        public CustomSpinnerSelection(Context context, AttributeSet attrs,
                int defStyle) {
            super(context, attrs, defStyle);
        }
    
        public CustomSpinnerSelection(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public CustomSpinnerSelection(Context context, int mode) {
            super(context, mode);
        }
    
        public CustomSpinnerSelection(Context context) {
            super(context);
        }
    
        @Override
        public int getSelectedItemPosition() {
            // this toggle is required because this method will get called in other
            // places too, the most important being called for the
            // OnItemSelectedListener
            if (!mToggleFlag) {
                return 0; // get us to the first element
            }
            return super.getSelectedItemPosition();
        }
    
        @Override
        public boolean performClick() {
            // this method shows the list of elements from which to select one.
            // we have to make the getSelectedItemPosition to return 0 so you can
            // fool the Spinner and let it think that the selected item is the first
            // element
            mToggleFlag = false;
            boolean result = super.performClick();
            mToggleFlag = true;
            return result;
        }
    
    }
    

    It should work just fine for what you want to do.

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

Sidebar

Related Questions

In order to choose categories, I want to use dropdown lists. Each list contains
i have cursor which selects records from my CarProfile table and use custom adapter
(Android 3.0+) How would I create a Spinner for use as an Action Item
I have an adapter and a spinner view which is set to use the
Currently I have a web application where a user can use dropdown lists to
I have a view where I use a dropdown list with enum: public enum
I have a requirement where I can use JS Fiddle dropdown to populate States
I'm building a mobile website. I use regular html for the dropdown like below.
I use this code to generate a spinner in my app: subCatAdapter = new
I want to use a Spinner that initially (when the user has not made

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.