Coming from
iOS world one thing I really missed when I first started coding in Android was this
fancy picker date of iOS, so I looked around Internet and I ran into this
project:
It seemed pretty cool to me and just exactly what I was looking for, however I had no
idea how to include it into my project; actually is very easy but first I had
to struggle a little bit wandering how to start and that’s why I post this small tutorial
hoping save time to those who are trying to use Android wheel.
If you go
to the Downloads tab in the project Web page the only thing you will get is the apk,
but what we need is the source code, so the key is get it via subversion.
If you are
working on MAC, subversion is already installed, but if you need type this line
on terminal to install it.
To install
subversion on Linux type:
For Debian
For Red Hat
To install
on Windows I choose the following client:
Once you’ve
installed subversion is very straightforward to get the source code, just type
on terminal:
In the path
you made the download, you will find two folders: wheel and wheel_demo, the
important one obviously is wheel, import it as project in eclipse: File->
Import-> General -> Existing Projects into Workspace and choose the
folder “wheel” you just download.
Done this we've finish, we can use now Android Wheel Classes to make look cool our app. In a second part for this post I will show an example.
Once we’ve
imported the source code, we need to add it as library to our project.
Go to
Project-> Properties -> Android, in section Library press the button Add and select
the wheel project
Done this we've finish, we can use now Android Wheel Classes to make look cool our app. In a second part for this post I will show an example.
I followed the above steps exactly, BUT when I import into Eclipse I get lots and lots of errors in the 'src' files.
ResponderEliminarAny suggestions?
in wheel-demo project do this:
Eliminarin each java file(CitiesActivity for example) change import kankan.wheel.R; with import kankan.wheel.demo.R;
hope it helps
me too
ResponderEliminari got the errors on WheelViewAdapter.java file
how to solve it?
irsaliv@gmail.com
thanks
Hi, Can you give an example of what kind of errors did you get?
ResponderEliminarEste comentario ha sido eliminado por el autor.
ResponderEliminarIn the last picture, after adding library project, DO NOT forget to press 'Apply' button. Otherwise the green tick would be changed to red error sign.
ResponderEliminari've pressed the apply button, but i still get the red error sign. do you know why?
EliminarSo where is the 2nd part of this?
ResponderEliminarRight here: http://tolkianaa.blogspot.com/2012/04/how-to-use-android-wheel-part-ii.html
ResponderEliminari got error on wheel_demo (wheel.jar missing in wheel bin)...
ResponderEliminari tried to add wheel to the library, i already clicked apply then OK.
ResponderEliminarbut when a check the properties again, the green tick had changed to red error sign.
do u know why?
THANKS :)
Este comentario ha sido eliminado por el autor.
EliminarBecause your SDK and project are not in same physical folder on hard disk, remember that the project and library must be in same disk partition phisically.
ResponderEliminarThanks it was helpfull :)
ResponderEliminaru have all just to check your project build target on properties
ResponderEliminarI have an sample app that has four spinning wheels with date, hour, minute and am(or pm). and i got d values (hour, minutes & am(or pm)) but i have one problem of getting days value because in my case did not get proper position so, please
ResponderEliminarcan anyone tell me, How can i get proper values from these wheels ? please see my below code.
private class DayArrayAdapter extends AbstractWheelTextAdapter {
private final int daysCount = 365;
@SuppressWarnings("unused")
int index_item = 0;
int day = 0;
Calendar calendar;
protected DayArrayAdapter(Context context, Calendar calendar) {
super(context, R.layout.day, NO_RESOURCE);
this.calendar = calendar;
setItemTextResource(R.id.monthday);
data = new ArrayList();
}
public int getItemId(int arg0) {
return arg0;
}
public View getItem(int index, View cachedView, ViewGroup parent) {
//int day = -daysCount / 2 + index;
this.index_item = index;
day = index;
Calendar newCalendar = (Calendar) calendar.clone();
newCalendar.roll(Calendar.DAY_OF_YEAR, day);
View view = super.getItem(index, cachedView, parent);
weekday = (TextView) view.findViewById(R.id.weekday);
if (day == 0) {
weekday.setText("");
} else {
DateFormat format = new SimpleDateFormat("EEE");
weekday.setText(format.format(newCalendar.getTime()));
}
monthday = (TextView) view.findViewById(R.id.monthday);
if (day == 0) {
monthday.setText("Today");
monthday.setTextColor(0xFF0000F0);
} else {
DateFormat format = new SimpleDateFormat("MMM d");
monthday.setText(format.format(newCalendar.getTime()));
monthday.setTextColor(0xFF111111);
data.add(format.format(newCalendar.getTime()));
}
return view;
}
public ArrayList getText() {
return data;
}
public int getItemsCount() {
return daysCount + 1;
}
protected CharSequence getItemText(int index) {
return "";
}
}
Este comentario ha sido eliminado por un administrador del blog.
ResponderEliminarEste comentario ha sido eliminado por un administrador del blog.
ResponderEliminarHow can I use this library in my android studio project?
ResponderEliminarPlease take a look at the new article (http://tolkianaa.blogspot.com/2016/01/how-to-use-android-wheel-v2-android.html) which show's how to integrate this library with Android Studio & Gradle.
Eliminar