Answer the question
In order to leave comments, you need to log in
DatePicker how to display the day of the week?
Or what is the best way to write this code?
selectDate.setOnClickListener {
val currentDate = Calendar.getInstance()
var year = currentDate.get(Calendar.YEAR)
var month = currentDate.get(Calendar.MONTH)
var day = currentDate.get(Calendar.DAY_OF_MONTH)
val listener = DatePickerDialog.OnDateSetListener {datePicker: DatePicker?, selectedYear: Int, selectedMonth: Int, selectedDay: Int ->
textView2.text = "$selectedDay/${selectedMonth + 1}/$selectedYear"
}
val datePicker = DatePickerDialog(this, listener, year, month, day)
datePicker.show()
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question