I want to select multiple dates in calendar in android

前端 未结 3 1901
无人及你
无人及你 2021-01-18 14:00

I want to select multiple dates in calendar,multiple select is working fine but in toast displaying only single date(first date).If I selected 4 days(1.8.14 to 4.8.14) all

3条回答
  •  醉话见心
    2021-01-18 14:18

    Use SelectionMode.MULTIPLE

    calendar.init(today, nextYear.getTime())
            .inMode(CalendarPickerView.SelectionMode.MULTIPLE);
    
    findViewById(R.id.btn_done).setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View view) {
        Log.d("TAGGG", "Selected time in millis: " + calendar.getSelectedDate().getTime());
        String toast = "Selected: " + calendar.getSelectedDates();
        Toast.makeText(CalenderItem.this, toast, Toast.LENGTH_SHORT).show();
    }
    });
    

提交回复
热议问题