pgsandstrom
pgsandstrom

Reputation: 14399

alternative to the missing setOnDateChangeListener()-function

I have a DatePicker-view as well as a TimePicker-view in my layout, and everytime the date or time is changed I want to update a value. On the TimePicker I can simply set a setOnTimeChangedListener, but nothing corresponding exists for the DatePicker. A listener called OnDateChangedListener can be set in the init()-function, but it does not trigger each time the date is changed. Is there a corresponding listener, or is there a hack available to solve this problem in a satisfactory manner?

http://developer.android.com/intl/de/reference/android/widget/DatePicker.html http://developer.android.com/intl/de/reference/android/widget/TimePicker.html

Cheers,

Upvotes: 0

Views: 471

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006974

A listener called OnDateChangedListener can be set in the init()-function, but it does not trigger each time the date is changed.

According to the source code, it is called each time the date is changed. So, try that again.

Upvotes: 3

Related Questions