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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:00:13+00:00 2026-06-12T00:00:13+00:00

<Spinner android:id=@+id/spinner1 android:layout_width=fill_parent android:layout_height=wrap_content android:layout_alignParentRight=true android:layout_below=@+id/editText2 android:layout_marginTop=22dp android:entries=@array/categorylist android:prompt=@string/category /> i have created spinner

  • 0
 <Spinner
    android:id="@+id/spinner1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/editText2"
    android:layout_marginTop="22dp"
    android:entries="@array/categorylist"
    android:prompt="@string/category" />

i have created spinner in the above format!

final Spinner spnr= (Spinner)findViewById(R.id.spinner1);
    String category=spnr.getSelectedItem().toString();

pushed the spinner values in db by getting value in above format.

now when values retrieved from db. the spinner should set according to specific value…
how can i implement any ideas pls??

  • 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-12T00:00:15+00:00Added an answer on June 12, 2026 at 12:00 am

    That can be possible only when you store the array of the items that are set as entries of Spinner. You can set the position of the selected item in spinner. So you have to find out index of the item that you query from the database. Load the StringArray of categorylist and iterate the array and compare each item with the item fetched from the database. Then set the index of the found item as selected item in spinner.

        String[] list = getResources().getStringArray(R.array.categorylist);
        int index = 0;
        for(String item : list) {
            if(item.equals("your_item")){
                break;
            }
            index++;
        }
        spinner.setSelection(index);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using default spinner <Spinner android:id=@+id/mySpinner android:layout_width=fill_parent android:layout_height=wrap_content ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_spinner_item);
i have created following layout. <TableLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal > <TableRow> <TextView android:layout_width=fill_parent android:layout_height=wrap_content
How to make spinner to fill empty place in left side? android:layout_width=fill_parent does not
This is my layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/LinearLayout1 android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical > <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/LinearLayout2
Here is my layout <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:id=@+id/LinearLayout01 android:layout_height=wrap_content> <Spinner android:text=@+id/AutoCompleteTextView01
I need to customize my android spinner. For this I created this spinner_selector.xml :
I'm trying to add an android-like spinner to my mobile website. To put everyone
I have an Android application with a Spinner and want to fill it dynamically
I'm developing an Android application with a spinner. I have this problem: This is
I am having an Android view with a Spinner on it. I call a

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.