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

  • Home
  • SEARCH
  • 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 7622857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:33:35+00:00 2026-05-31T04:33:35+00:00

How to get values into the spinner from the DB. I want to display

  • 0

How to get values into the spinner from the DB. I want to display values or datas on UI from DB. Is it cursor necessary to use to populate the values onto the UI?

  • 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-31T04:33:36+00:00Added an answer on May 31, 2026 at 4:33 am

    I just follow the things to get the values from database, when the spinner values changed by postion –

    Java class

    Spinner spinner = (Spinner) findViewById(R.id.spinner1);
    //set some adapter here
    spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
    
    public class MyOnItemSelectedListener implements OnItemSelectedListener 
    {
    @SuppressWarnings("unused")
    public void onItemSelected(AdapterView<?> parent,View view, int pos, long id)
    {
    try
        {
        switch(parent.getId())
        {
        case R.id.spinner2:
    
            int selected_spinner_item_position=pos;
    
            String expired_spinner_item =parent.getItemAtPosition(pos).toString();
            if(selected_spinner_item_position==0)
            {
                //am just using simple cursor adapter here and getting the values from database using dh.fetchAll() when the position is 0
                sc_adapter(dh.fetchAll());
                spinnertemp = selected_spinner_item_position;
            }
            }
        }
    }
    }
    

    Database

    public Cursor fetchAll()
    {
        SQLiteDatabase db = this.getReadableDatabase();
        cursor = db.query(t1, new String[] {"_id",task, pname, prior, time, dateformat, duptitle,dupname}, "stat=0", null, null, null, prior);
        return cursor;
    }
    

    Just do what you need like these steps.

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

Sidebar

Related Questions

I'm using JSON to get some values into a variable from an external source.
Using VB.Net I want to get a all datagrid cell values, then insert into
I am going nuts trying to use PHP to get and insert values into
Greetings , Is there any way to get values from web.xml context-param into Spring
I just want to SELECT values into variables from inside a procedure. SELECT blah1,blah2
How do I get the value from a key pair value into the rel
I need to get the value from the parent form into the child; not
I'm attempting to get the cell value from a gridview but running into a
I have a Spinner with an ArrayAdapter that feeds Values into it. The layout
I am using SimpleINI to get values into std::stringstream my_string; - CSimpleIniCaseA::TNamesDepend::const_iterator i; for

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.