How can i select date in Range in android ? i want a dialog that is shown in this attach image this Dialog is in fragment .
this is code is Onclick of Date Edittext layout:
dateLI.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
MaterialDatePicker.Builder<Pair<Long, Long>> builder =
MaterialDatePicker.Builder.dateRangePicker();
CalendarConstraints.Builder constraintsBuilder = new CalendarConstraints.Builder();
builder.setCalendarConstraints(constraintsBuilder.build());
MaterialDatePicker<Pair<Long,Long>> picker = builder.build();
assert getFragmentManager() != null;
picker.show(getFragmentManager(), picker.toString());
}
});
by using this i face this error" r requires a value for the com.example.indicaatabinspector:attr/colorSurface attribute to be set in your app theme. You can either set the attribute in your theme or update your theme to inherit from Theme.MaterialComponents (or a descendant)."