c

    codeslubber

    2 years ago
    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

    2 years ago
    Can you share what you did?
    c

    codeslubber

    2 years ago
    Sure
    @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

    2 years ago
    Thanks!