I am trying to make a wheel picker, for example this I tried to download this project, but the only files included in the .zip download are the -demo.apk and notes.txt wheels. Notes.txt does not provide instructions on how to use this file in Android studio. I found a post that suggested using ListViews to create the same effect. Instead of making my own, I spent another day on the Internet and I found the source code here , but when I imported the files into my project, the IDE showed dozens of errors. Through the trial version and the error, I managed to fix everything except 3 errors. Pretty sure I put the appropriate code below
MainActivity.java:
OnWheelScrollListener scrolledListener = new OnWheelScrollListener() { public void onScrollingStarted(WheelView wheel) { wheelScrolled = true;
OnWheelScrollListener.java:
public interface OnWheelScrollListener { void onScrollingStarted(WheelView wheel); void onScrollingFinished(WheelView wheel);}
OnWheelChangedListener.java:
public interface OnWheelChangedListener { void onChanged(WheelView wheel, int oldValue, int newValue); }
ArrayWheelAdapter.java
public class ArrayWheelAdapter<T> extends AbstractWheelTextAdapter { // items private T items[]; /** * Constructor * @param context the current context * @param items the items */ public ArrayWheelAdapter(Context context, T items[]) { super(context); //setEmptyItemResource(TEXT_VIEW_ITEM_RESOURCE); this.items = items; } @Override public CharSequence getItemText(int index) { if (index >= 0 && index < items.length) { T item = items[index]; if (item instanceof CharSequence) { return (CharSequence) item; } return item.toString(); } return null; } @Override public int getItemsCount() { return items.length; } }
All 3 .java files were added to the import list in MainActivity, thinking that this might solve the problem, but this did not happen. Thanks for the advice so far.
source share