Here is how i would do it, Create a Calendar.getInstance() Object then using that calendar object, access its time, which will give current date Add seven days from to this current date and pass this as an array object into the deactivateDateMethod or you set it as the initial date. Users wont be able to access the other dates if it is the initial date anyways.
Taking the latter approach in Kotlin,
val cal = Calendar.getInstance()
cal.add(cal[Calendar.DAY_OF_YEAR], 7)
val dates = arrayOf(cal.time)
datePickerTimeline.setInitialDate(
cal[Calendar.YEAR],
cal[Calendar.MONTH],
cal[Calendar.DAY_OF_MONTH]
)
I think you can do the calculations yourself.
Here is how i would do it, Create a Calendar.getInstance() Object then using that calendar object, access its time, which will give current date Add seven days from to this current date and pass this as an array object into the deactivateDateMethod or you set it as the initial date. Users wont be able to access the other dates if it is the initial date anyways.
Taking the latter approach in Kotlin,
val cal = Calendar.getInstance() cal.add(cal[Calendar.DAY_OF_YEAR], 7) val dates = arrayOf(cal.time)
datePickerTimeline.setInitialDate(
cal[Calendar.YEAR],
cal[Calendar.MONTH],
cal[Calendar.DAY_OF_MONTH]
)
Edited, added actual methods in kotlin