I have this code here on the options menu
Dialog dialog = new Dialog(ScheduleActivity.this);
dialog.setTitle(\"Add Event\");
dialog.setContentView(R.layout.
Use it like this in Koltin
DatePickerDialog(this as Activity, DatePickerDialog.OnDateSetListener { p0, y, m, _ -> func.invoke(y, m + 1) }, c.get(Calendar.YEAR),
c.get(Calendar.MONTH),
c.get(Calendar.DAY_OF_MONTH))
.show()
Use it from anywhere
tvDateFrom.click {
showDatePicker(c) { y, m ->
Utils.debugger("DATE FROM ", " y + $y m $m")
tvDateFrom.text = "$m-$y".toDate()
}
}