Android - OnDateChangedListener - how do you set this?

后端 未结 5 1522
挽巷
挽巷 2020-11-29 07:48

There is an event listener in Android called DatePicker.OnDateChangedListener. I am trying to set a DatePicker view\'s on date changed listener as follows:

5条回答
  •  悲&欢浪女
    2020-11-29 08:38

    This view is in fact a combination of four views, and they are :

    Three Spinners

    One CalendarView

    As of the OnDateChangeListener, the object you passed in to the init method will be simply passed to the contained CalendarView, and I believe that you know that there is a setOnDateChangeListener method in the good old CalendarView...... ......

    In the DatePicker class, there is a method called the getCalendarView, and it is the method you can call if you want to get your hands on the contained CalendarView.

    Once you get your hands on the contained CalendarView, then, needlessly to say, you can call its setOnDateChangeListener

提交回复
热议问题