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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:29:40+00:00 2026-06-08T23:29:40+00:00

as demonstrated here by jalopaba, I already created a new class: How do you

  • 0

as demonstrated here by jalopaba, I already created a new class: How do you get the selected value of a Spinner?

public class MyItemSelectedListener implements OnItemSelectedListener {

    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
        String selected = parent.getItemAtPosition(pos).toString();
    }

    public void onNothingSelected(AdapterView parent) {
        // Do nothing.
    }
}

and registering this to the spinner in the original class:

spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());

However, I still can’t use that selected string yet to fill in my code in the same class:

textView.setText(selected);

I’m new to this Android anyway, so this question may be too dummy to some of you

  • 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-08T23:29:41+00:00Added an answer on June 8, 2026 at 11:29 pm

    Add the setText code in the onItemSelected:

    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
        yourTextView.setText(parent.getSelectedItem().toString);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
I have the following problem: http://jsfiddle.net/DerNa/12/ Which is demonstrated more clearly the jump here:
Here is the code that demonstrates my problem (All in the same namespace): public
As demonstrated here: http://jsfiddle.net/beardedgrandma/x8fy9/ this regex: /([\w .]*)[~]([\w .]*)(\(|Release Date)/ fails on this text
I'm trying to load jquery into Rhino as demonstrated by this link here .
I am trying to implement custom attribute validation, similar to one demonstrated here in
I'm using this 'version' of sticky footer: http://ryanfait.com/sticky-footer/ Here's where I'm trying to get
Here's what I'm thinking: class Widget < ActiveRecord::Base has_one :widget_layout end class WidgetLayout <
The best example for what is happening is demonstrated here . My code is
I have a simple page here to demonstrate the issue that I am seeing.

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.