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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:35:19+00:00 2026-06-12T23:35:19+00:00

i am new in Android development. Im trying to transfer selected data from multiple

  • 0

i am new in Android development.

Im trying to transfer selected data from multiple spinners (Search activity) to another activity (JSON Search result activity)

and at the end i have button that open the search result

Search activity:
i have the java spinner

ArrayAdapter<CharSequence> whatlist = ArrayAdapter.createFromResource(this, 
R.array.whatlist, android.R.layout.simple_spinner_item);
whatlist.setDropDownViewResource(R.layout.spinner_style);
spwhat = (Spinner) findViewById(R.id.spWhat);
spwhat.setAdapter(whatlist);
spwhat.setOnItemSelectedListener(new MyOnItemSelectedListener());

and the MyOnItemSelectedListener

   public class MyOnItemSelectedListener implements OnItemSelectedListener {
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id)  {

            strs = new Bundle();
            Intent i = new Intent(SearchActivity.this, SearchResult.class);
            strs.putString("setwhat", parent.getItemAtPosition(pos).toString());
            i.putExtras(strs);

        }
        public void onNothingSelected(AdapterView<?> arg0) {}
    }

This is the button

btnsearch = (Button)findViewById(R.id.btnSearch);
btnsearch.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            Intent ia = new Intent(SearchActivity.this, SearchResult.class);
            SearchActivity.this.startActivity(ia);
        }
    });

This is in the search result

  Bundle extras = getIntent().getExtras();
  if(extras!=null){


            Integer item = extras.getInt("setwhat");
            //Use a switch(item) here to switch to different links based on selection
            TextView tv = (TextView) findViewById(R.id.tvtv);
            tv.setText("Another Activity, Item is :" + item.toString());

the text wont change.
i have tried any tutorial on the web and searching here for a solution for hours..
anyone can help?

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

    You don’t even need a listener for your spinner. Just change your button’s onclick to this:

    btnsearch = (Button)findViewById(R.id.btnSearch); 
    btnsearch.setOnClickListener(new View.OnClickListener() {
    
        public void onClick(View v) {
    
            Spinner spwhat = (Spinner) findViewById(R.id.spWhat);
    
            Intent ia = new Intent(SearchActivity.this, SearchResult.class);
            ia.putExtra("setwhat", spwhat.getSelectedItem().toString());
            startActivity(ia);
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to Android development and I am trying to handle multiple button
i am new to android development. i am trying to post data to server
i m new to android development. i am trying to insert data into remote
I'm new in android development. I have been trying to start a new activity
I am new to android development and I've hit a hurdle when trying to
I am new to android development . I'm trying to download and run the
I'm new to Android development, i'm trying to port an IOS app to Android.
I'm new to Android development. My OS is WinXP. I'm trying to install two
I am new to using SQLite databases and android mobile development. I am trying
I am new to Android Development and trying to create a sample application. Can

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.