Show Only Current and previous month in date picker dialog.
datePickerDialog = new DatePickerDialog(DateConvertActivity.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
String s = "" + dayOfMonth + "-" + (month + 1) + "-" + year;
edtDate.setText(s);
}
}, mDay, mMonth, mYear);
datePickerDialog.getDatePicker().updateDate(mYear, mMonth, mDay);
Try this solution. It's from first day of previous month to this day.
In Kotlin:
And in Java:
If you need WHOLE current month (from first to last day) you can replace par with this Kotlin code:
and in Java: