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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:40:37+00:00 2026-05-29T19:40:37+00:00

How to get value from the spinner array..and passing the value to next page

  • 0

How to get value from the spinner array..and passing the value to next page using the intent. THis is my spinner and string.xml. Please give me some advise. Thank you

//spinner list

 private String foodorder;

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.search);

Spinner spinner = (Spinner) findViewById(R.id.spinner1);
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
                this, **R.array.food_array**, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);   
        spinner.setOnItemSelectedListener(foodList);

Button search_btn = (Button)findViewById(R.id.search_button);
        search_btn.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
            Intent it = new Intent();
            it.setClass(searchfood.this, search_displayResult.class);

            Bundle bundle = new Bundle();
            bundle.putString("KEY_DEPARTURE", ); //what should i put here?


            }
        });

}
    private Spinner.OnItemSelectedListener foodList = new Spinner.OnItemSelectedListener () {
             public void onItemSelected(AdapterView parent, View v, int position,long id) {
                 foodorder = parent.getSelectedItem().toString();
             }
             public void onNothingSelected(AdapterView parent) {

             }
     };

String.xml

<string name="food_prompt">Choose a food</string>
    <string-array name="food_array">   
        <item>Fish Burger</item>
        <item>French Fried</item>
        <item>Beef Burger</item>
        <item>Chicken Burger</item>
        <item>Salad</item>

    </string-array>
  • 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-29T19:40:39+00:00Added an answer on May 29, 2026 at 7:40 pm

    try

    Spinner.getSelectedItem().toString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get a value from another page. But I get this error
How to convert double to a string value that I get from the spinner,
Is it possible to get the value from the first page to the second
Is it possible to get the value from a JavaScript variable and use this
I'm new in iPhone Application Programming. I can't get value from XML file and
How can i get value from database.php page? I mean we can access base
How can I get the value from the following tags: {desc=1} This is a
I want to get variable value from an objective-c class, using reflection. company.h looks
Please help me with T-SQL query in SQL 2008 to get value from between
Given a SharePoint page URL (http://server:8000/Pages/Default.aspx), how can I get value from the fields

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.