I am using https://github.com/prolificinteractive/material-calendarview
Right now it is changing the month on the click of Right or Left arrow
How can i change the year directly instead of changing month.
Is this possible android default Calendar View.
Below is my code for prolificinteractive - calendar
public class ActivityCalendar extends AppCompatActivity implements OnDateSelectedListener, OnMonthChangedListener {
private static final DateFormat FORMATTER = SimpleDateFormat.getDateInstance();
private MaterialCalendarView widget;
private String zodiacSign = "";
private HashMap<String,Integer> hashMapMonth = new HashMap<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_calendar);
widget = (MaterialCalendarView)findViewById(R.id.calendarView);
widget.setOnDateChangedListener(this);
widget.setOnMonthChangedListener(this);
}
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @Nullable CalendarDay date, boolean selected) {
String strDate = getSelectedDatesString();
Intent returnIntent = new Intent();
returnIntent.putExtra(TagClass.BIRTH_DATE, strDate);
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
@Override
public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) {
//noinspection ConstantConditions
}
private String getSelectedDatesString() {
CalendarDay date = widget.getSelectedDate();
if (date == null) {
return "No Selection";
}
return FORMATTER.format(date.getDate());
}
}
Layout.XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ActivityCalendar">
<com.prolificinteractive.materialcalendarview.MaterialCalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>