https://kotlinlang.org logo
c

codeslubber

01/03/2020, 1:50 AM
Has anyone done a
DatePicker
with Compose yet? trying to invoke it as a dialog.. the playground doesn’t have an example.. are examples of doing
AlertDialog
of course
got this to work..
p

Philip Blandford

01/07/2020, 6:45 PM
Can you share what you did?
c

codeslubber

01/07/2020, 6:46 PM
Sure
Copy code
@Composable
fun showDatePicker() {
    if (showDialog.value){
        Log.d(logTag, "inside dialog...")
        DatePickerDialog(
            context,
            DatePickerDialog.OnDateSetListener { view, year, month, day ->
                Log.d("DEBUG", "inside onDateSetListener..")
            },
            2020,
            0,
            1
        ).show()
    }
}
then this is called like any other dialog, from the main composable subject to the state of the
showDialog
property..
p

Philip Blandford

01/07/2020, 6:51 PM
Thanks!
👍🏻 1
6 Views