'How get data from calendarView Android? Nothing happend then i click

Nothing happend then i click data from calendar. i dont know that wrong with this code calendarView= headerLayout.findViewById(R.id.calendarView)

    calendarView.setOnDateChangeListener { view, year, month, dayOfMonth ->
        var mStr = ""
        var dStr = ""
        mStr = if (month + 1 <= 9) "0$month"
        else (month + 1).toString()
        dStr = if (dayOfMonth <= 9) "0$month"
        else (dayOfMonth).toString()
        var data = "$year$mStr$dStr"
        Toast.makeText(
            applicationContext,
            "You set $dStr/$mStr/$year",
            Toast.LENGTH_SHORT
        ).show()
        }
    }

`



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source