1

I am trying to implement a Date Picker but i am getting the following lint error


Raw use of parameterized class 'MaterialDatePicker.Builder'

Below is my code for the Material Date Picker


MaterialDatePicker.Builder builder = MaterialDatePicker.Builder.datePicker();

        builder.setTitleText("Select date range of publication");

        // If you want to set theme here
        //builder.setTheme(R.style.MaterialTheme);

        MaterialDatePicker<Long> materialDatePicker = builder.build();

        materialDatePicker.show(getParentFragmentManager(),"DATE_PICKER");

        materialDatePicker.addOnPositiveButtonClickListener(selection -> {

            etDatesToPublish.setText(materialDatePicker.getHeaderText());

        });

Emmanuel Njorodongo
  • 1,004
  • 17
  • 35
  • I have tried to answer your query. Please try running it thus and you mark it as correct if it works for you. – che10 Jun 16 '21 at 06:19

1 Answers1

4

The class expects a parameter which you have not provided to it and thus you are trying to use it raw.

It will be as follows

MaterialDatePicker.Builder<Long> builder = MaterialDatePicker.Builder.datePicker();
che10
  • 2,176
  • 2
  • 4
  • 11