I implemented Month/Year selection by DateSlider for Calendar View.
Now on click the button with the name of selected month, there will appear a dateslider dialogue. Select month and year and calendar will be show selected month.
edit the following code:
find the line currentMonth.setText(dateFormatter.format(dateTemplate, _calendar.getTime()));
currentMonth.setOnClickListener(this);
in public void onClick(View v)
function add the following code:
if (v == currentMonth) { showDialog(DATE_DIALOG_ID); }
and the following functions:
// Creating dialog @Override protected Dialog onCreateDialog(int id) { Calendar c = Calendar.getInstance(); switch (id) { case DATE_DIALOG_ID: //return new DatePickerDialog(this, mDateSetListener, cyear, cmonth, cday); return new MonthYearDateSlider(this, mDateSetListener, c); } return null; } // define the listener which is called once a user selected the date. private DateSlider.OnDateSetListener mDateSetListener = new DateSlider.OnDateSetListener() { public void onDateSet(DateSlider view, Calendar selectedDate) { setGridCellAdapterToDate(selectedDate.get(Calendar.MONTH)+1, selectedDate.get(Calendar.YEAR)); } };