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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:38:46+00:00 2026-06-04T19:38:46+00:00

I have this code: package lijap.app.starcraft2counters; import java.io.File; import android.app.Activity; import android.os.Bundle; import android.os.Environment;

  • 0

I have this code:

package lijap.app.starcraft2counters;

import java.io.File;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;

public class Settings extends Activity implements OnItemSelectedListener {
Spinner answertime;
Spinner gametime;
Spinner missesallowed;

String[] answerseconds = { "Unlimited", "1 second", "2 seconds", "3 seconds",
        "4 seconds", " 5 seconds" };

String[] gameminutes = { "Unlimited", "1 minute", "2 minutes", "3 minutes",
        "4 minutes", " 5 minutes" };

String[] numberofmisses = { "Unlimited", "5", "10", "15",
        "20", "25" };

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.settings);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(Settings.this,
            android.R.layout.simple_spinner_item, gameminutes);

    answertime = (Spinner) findViewById(R.id.s_answertime);
    answertime.setAdapter(adapter);
    answertime.setOnItemSelectedListener(this);
}

@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
        long arg3) {
    // TODO Auto-generated method stub


}

@Override
public void onNothingSelected(AdapterView<?> arg0) {
    // TODO Auto-generated method stub

}
}

I am getting confused trying to put in more than 1 spinner. Do I share the array adapter, or do I create a new one for each? What about the onItemSelected? As you can see from my strings at the top, I want three spinners. How would I do this?

I am new to android, as you can tell. All help is appreciated- Lijap

  • 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-04T19:38:48+00:00Added an answer on June 4, 2026 at 7:38 pm

    You could share the adapter between different Spinners if they adapted the same information. Clearly each of your adapters need to adapt a different set of Strings, so you need to create an ArrayAdapter for each Spinner.

    A single OnItemSelectedListener will work for the 3 Spinners (as long as you set them). You can call getId() on the AdapterView<?> passed as an argument to know which Spinner raised the event.

    public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
            long arg3) {
        switch(arg0.getId()){
            case R.id.s_answertime:
                break;
            case ...
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this code package com.tct.soundTouch; import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.MotionEvent;
I have this code: package com.problemio; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View;
I have this code: package org.example.Threading; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Message;
I have this code: package com.powergroupbd.timer; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.CountDownTimer;
I have this code package com.cerbertek; import java.util.ArrayList; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory;
I have this code, for a android app i'm working on: package com.exercise.AndroidInternetTxt; import
I have this code: package com.problemio; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList;
I have this code: package picalculator; //import java.util.Scanner; public class PiCalculator { static int
I am writing an updater. I have this code: package main; import java.io.*; import
I have this Code... ifsDAO.java package source; import java.sql.*; import java.sql.SQLException; import java.util.*; public

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.