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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:09:19+00:00 2026-05-28T22:09:19+00:00

i am new to android, am trying to store the spinner value to the

  • 0

i am new to android, am trying to store the spinner value to the database, but am getting error while storing it into the database. can any one please help me.
here is my code,

mGender = (Spinner)findViewById(R.id.spinner1);
String gender = mGender.toString();
values.put("gender", gender);

i changed the code, so i can read the spinner value, but when i check my database it is not showing the exact information that is given in the spinner, it is showing something like

android.widget.Spinner@41372738
android.widget.Spinner@41382ae0

for the same values. Can anyone please help me.

thanks in advance

  • 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-28T22:09:19+00:00Added an answer on May 28, 2026 at 10:09 pm

    finally i found the answer for this question by going through the different tutorials and samples. the solution for this is:

    mGender = (Spinner)findViewById(R.id.spinner1);
    
            // Spinner method to read the on selected value
            ArrayAdapter<State> spinnerArrayAdapter = new ArrayAdapter<State>(this,
                      android.R.layout.simple_spinner_item, new State[] {   
                            new State("Male"), 
                            new State("Female")});
            mGender.setAdapter(spinnerArrayAdapter);
            mGender.setOnItemSelectedListener(this);
    
    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) 
        {
            // Get the currently selected State object from the spinner
            State st = (State)mGender.getSelectedItem();
    
            // Show it via a toast
            toastState( "onItemSelected", st );
        } 
    
    public void toastState(String name, State st) 
    {
        if ( st != null )
        {
            Gen = st.name;
        //Toast.makeText(getBaseContext(), Gen, Toast.LENGTH_SHORT).show();
    
        }
    
    }
    
    public void onNothingSelected(AdapterView<?> arg0) {
        // TODO Auto-generated method stub
    
    }
    

    you have to create a spinner and assign the values in onCreate method. and one more class State for reading the spinner values.

    public class State 
    {
        public String name = "";
    
    
        public State(String _name)
        {
    
            name = _name;
    
        }
        public String toString()
        {
            return name;
        }
    
    
    }
    

    Thank You all….

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

Sidebar

Related Questions

I am trying to Set Location but getting NullPointerException , i have Provided android.permission.ACCESS_COARSE_LOCATION
I have been trying to store image form android sdcard to the sqlite database.
I'm trying to store a Map into android's internal storage. My code: private void
Hello StackOverflow Users, I am new to android and trying to develop a game
I am new to android..Actually iam trying to increase the RAM Memory of android
I'm trying to record audio this.recorder = new android.media.MediaRecorder(); this.recorder.setAudioSource(android.media.MediaRecorder.AudioSource.MIC); this.recorder.setOutputFormat(android.media.MediaRecorder.OutputFormat.DEFAULT); this.recorder.setAudioEncoder(android.media.MediaRecorder.AudioEncoder.DEFAULT); this.recorder.setOutputFile(pruebaAudioRecorder.mp4); **this.recorder.prepare();**
im new to android and I've been trying to figure out how to display
i am new to android programming and i am trying to develop an app
I am new to android programming and i am trying to develop this app
New with Android. Sorry! I'm trying to create the following... Wait for Timer to

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.