It would look something like this:
val c = Calendar.getInstance()
val year = c.get(Calendar.YEAR)
val month = c.get(Calendar.MONTH)
val day = c.get(Calendar.DAY_OF_MONTH)
val dpd = DatePickerDialog(activity, DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth ->
// Display Selected date in textbox
lblDate.setText("" + dayOfMonth + " " + MONTHS[monthOfYear] + ", " + year)
}, year, month, day)
dpd.show()
this was done by simply copying and pasting the code into a kotlin file in android studio. I would strongly recommend using it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…