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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:44:37+00:00 2026-06-15T14:44:37+00:00

Im trying use the spinner control result in order to point it to another

  • 0

Im trying use the spinner control result in order to point it to another screen that would be on the app. For example in the spinner control if the user chose chevy it would then take you to another screen which is coded in chevy.xml and Chevy.class. This is what i have thus far and need some help, as our book only used getSelectedItem and the example was only for an output statement.

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Spinner;          

 public class Mainpage extends Activity implements OnItemSelectedListener {
    String carChoice, chevy, ford, dodge, toyota;

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

  /*  carChoice = group.getSelectedItem().toString();
    }

     if (carChoice.compareTo(chevy)==0)
     {
     startActivity(new Intent(Mainpage.this, Chevy.class));
  */ }

    public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
        final Spinner group = (Spinner) findViewById(R.id.carGroup);
        group.setOnItemSelectedListener(this);
        // TODO Auto-generated method stub
         String selected = group.getItemAtPosition(1).toString();           
    }
    public void onNothingSelected(AdapterView<?> arg0) {
        // TODO Auto-generated method stub
    }
 }
  • 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-15T14:44:39+00:00Added an answer on June 15, 2026 at 2:44 pm

    For

    public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
          long arg3)
    

    arg2 is the index of selected item, arg3 is id of selected item. You may call getItem() method to get selected item object.

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

Sidebar

Related Questions

Trying to make a spinner in android: package com.example.test; import android.app.Activity; import android.widget.ArrayAdapter; import
I am trying use a Java Uploader in a ROR app (for its ease
trying to use hibernate with my web app and getting following exception: Initial SessionFactory
For an Android application, I'm trying to use a Spinner which, when an option
(Android 3.0+) How would I create a Spinner for use as an Action Item
I'm trying to make a simple order system. So the user selects a burger
In an ASP.NET MVC project I'm trying to use jQuery spinner plugin . All's
I am trying to integrate Facebook login with my app. It's simple: a user
I'm trying to use jqm's loading spinner as details here: http://jquerymobile.com/test/docs/pages/loader.html Calling $.mobile.loading('show'); or
Hey so I am trying to use Shared Preferences to store information that is

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.