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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:57:53+00:00 2026-05-26T22:57:53+00:00

Hello all i have the code below which produces four wheels each with the

  • 0

Hello all i have the code below which produces four wheels each with the numbers 0-9. I think these numbers are being called for each wheel in the section of code after:

/**
* Initializes wheel
* @param id the wheel widget Id
*/

Is there a way i can change this so i can set certain WORDS instead of NUMBERS for each one of the four wheels like and array or string.

So i would have four arrays (strings) with different words for each wheel.

Thanks in advance.

public class PasswActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.passw_layout);
    initWheel(R.id.passw_1);
    initWheel(R.id.passw_2);
    initWheel(R.id.passw_3);
    initWheel(R.id.passw_4);

    Button mix = (Button)findViewById(R.id.btn_mix);
    mix.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mixWheel(R.id.passw_1);
            mixWheel(R.id.passw_2);
            mixWheel(R.id.passw_3);
            mixWheel(R.id.passw_4);
        }
    });


}

// Wheel scrolled flag
private boolean wheelScrolled = false;

// Wheel scrolled listener
OnWheelScrollListener scrolledListener = new OnWheelScrollListener() {
    public void onScrollingStarted(WheelView wheel) {
        wheelScrolled = true;
    }
    public void onScrollingFinished(WheelView wheel) {
        wheelScrolled = false;

    }
};

// Wheel changed listener
private OnWheelChangedListener changedListener = new OnWheelChangedListener() {
    public void onChanged(WheelView wheel, int oldValue, int newValue) {
        if (!wheelScrolled) {

        }
    }
};




/**
 * Initializes wheel
 * @param id the wheel widget Id
 */
private void initWheel(int id) {
    WheelView wheel = getWheel(id);
    wheel.setViewAdapter(new NumericWheelAdapter(this, 0, 9));
    wheel.setCurrentItem((int)(Math.random() * 10));

    wheel.addChangingListener(changedListener);
    wheel.addScrollingListener(scrolledListener);
    wheel.setCyclic(true);
    wheel.setInterpolator(new AnticipateOvershootInterpolator());
}

/**
 * Returns wheel by Id
 * @param id the wheel Id
 * @return the wheel with passed Id
 */
private WheelView getWheel(int id) {
    return (WheelView) findViewById(id);
}

/**
 * Tests entered PIN
 * @param v1
 * @param v2
 * @param v3
 * @param v4
 * @return true 
 */
private boolean testPin(int v1, int v2, int v3, int v4) {
    return testWheelValue(R.id.passw_1, v1) && testWheelValue(R.id.passw_2, v2) &&
        testWheelValue(R.id.passw_3, v3) && testWheelValue(R.id.passw_4, v4);
}

/**
 * Tests wheel value
 * @param id the wheel Id
 * @param value the value to test
 * @return true if wheel value is equal to passed value
 */
private boolean testWheelValue(int id, int value) {
    return getWheel(id).getCurrentItem() == value;
}

/**
 * Mixes wheel
 * @param id the wheel id
 */
private void mixWheel(int id) {
    WheelView wheel = getWheel(id);
    wheel.scroll(-25 + (int)(Math.random() * 50), 2000);
}

}

  • 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-26T22:57:53+00:00Added an answer on May 26, 2026 at 10:57 pm

    Just use an ArrayWheelAdapter<T> instead of the NumericWheelAdapter.

    If you look closely at your own code, you will find a line where your adapter is created

    new NumericWheelAdapter(this, 0, 9)
    

    An adaptor is something the wheel UI can hook onto and grab data to display. This will create an adapter containing the numbers zero through nine. To create an adapter that displays the words “Abc”, “Foo”, and “Bar” use this.

    new ArrayWheelAdapter<String>(this, new String[]{"Abc", "Foo", "Bar"})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem Hello all! I have this code which takes my jpg image loops through
hello all I have a small dialog which I created dynamically, which has a
I have below code in html <div id=divTest> Hello <input type=text id=txtID/> <input type=text
I have below html code <div id=divTest> Hello <input type=text id=txtID value= /> <input
I have a piece of code below which I am trying to use to
I have what I thought was a simple .NET Remoting Client/Server (Code Below)... When
Hello all I have a problem with understanding the bitsort program in Bentley's classic
Hello all i have a simple problem i have a alertDialog and i want
Hello all i have a wheel picker working but at the moment it is
I have the HTML code below. I have set the body's width to 640px

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.