问题
I have implemented a calendarview in my project, i can get the day of the month, the month and the year, but i cant find any method to get the day of the week, my code is this:
view = new CalendarView(this);
setContentView(view);
view.setOnDateChangeListener(new OnDateChangeListener() {
@Override
public void onSelectedDayChange(CalendarView arg0, int year,
int month, int dateb) {
And when i choose a day in calendar i would need to get the week day to, I'm trying to get the answer but i cant find.
Sorry for my english.
回答1:
You could always use the Calendar and set it through the time you get from the calendar view:
Calendar selected = Calendar.getInstance();
selected.setTimeInMillis(view.getDate());
int dayOfWeek = selected.get(Calendar.DAY_OF_WEEK);
Each of the int values correspond to one of the days, for example Calendar.TUESDAY = 3
Hope it helps
来源:https://stackoverflow.com/questions/29299292/get-the-week-day-from-a-calendarview-in-android