I'm trying to figure out how to get the current selected date to be showned on the CalendarDatePicker. E.g.
If i have September 13, 2016 as the date being selected it should be shown/highlighted on the CalendarDatePicker that i selected that date. So i set the date and display it on a textview, and if I update the date it should get the previous selected date being highligted on the CalendarDatePicker. I've added their onDayOfMonthSelected() method but it still not working. This is what i have so far. I'm using this library Android-BetterPicker from github.
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final CalendarDatePickerDialogFragment cdp2 = new CalendarDatePickerDialogFragment()
.setOnDateSetListener(CalendarPicker.this);
cdp2.show(getSupportFragmentManager(), FRAG_TAG_DATE_PICKER);
cdp2.setOnDateSetListener(new CalendarDatePickerDialogFragment.OnDateSetListener() {
@Override
public void onDateSet(CalendarDatePickerDialogFragment dialog, int year, int monthOfYear, int dayOfMonth) {
mResultTextView.setText(getString(R.string.calendar_date_picker_result_values, year, monthOfYear+1, dayOfMonth));
}
});
}
});
Here's my onResume() function
public void onResume() {
// Example of reattaching to the fragment
super.onResume();
CalendarDatePickerDialogFragment calendarDatePickerDialogFragment = (CalendarDatePickerDialogFragment) getSupportFragmentManager()
.findFragmentByTag(FRAG_TAG_DATE_PICKER);
if (calendarDatePickerDialogFragment != null) {
calendarDatePickerDialogFragment.onDayOfMonthSelected(CHOSEN_YEAR,CHOSEN_MONTH,CHOSEN_DAY);
calendarDatePickerDialogFragment.setOnDateSetListener(this);
}
}