Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19192

Android: Date & Time Picker change event not fired nor is picker.value updated

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: Release 5.2.0
    • Component/s: Android
    • Labels:
    • Environment:

      Android 5
      Titanium SDK 4.1.0.v20150427212043

    • Story Points:
      5
    • Sprint:
      2015 Sprint 15 SDK, 2015 Sprint 20 SDK

      Description

      On Android 5, the Titanium date picker is broken.

      1. It no longer fires the changed event so you can't obtain the selected value as it updates. This happens whether on Ti SDK 4.X or 3.5.1.GA.
      2. It no longer updates the picker.value so you can't obtain the selected value on demand. This works on Ti SDK 3.5.1.GA, so seems to be an issue only on Ti SDK 4.X.

      Ti.UI.backgroundColor = 'white';
      var win = Ti.UI.createWindow({
          exitOnClose: true,
          layout: 'vertical'
      });
       
      var picker = Ti.UI.createPicker({
          type:Ti.UI.PICKER_TYPE_DATE,
          minDate:new Date(2009,0,1),
          maxDate:new Date(2014,11,31),
          value:new Date(2014,3,12),
          top:50
      });
       
      win.add(picker);
      win.open();
       
      picker.addEventListener('change',function(e){
          alert("User selected date: " + e.value.toLocaleString());
      });
       
      setTimeout(function() {
          alert('picker.value: ' + picker.value);
      }, 10000);
      

      Note that this alternative approach works:

      Ti.UI.backgroundColor = 'white';
       
      var picker = Ti.UI.createPicker({
          type:Ti.UI.PICKER_TYPE_DATE,
          minDate:new Date(2009,0,1),
          maxDate:new Date(2014,11,31),
          value:new Date(2014,3,12)
      });
       
      picker.showDatePickerDialog({
          value: new Date(2010,8,1),
          callback: function(e) {
              if (e.cancel) {
                  alert('User canceled dialog');
              } else {
                  alert('User selected date: ' + e.value);
              }
          }
      });
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                msamah Ashraf Abu (Inactive)
                Reporter:
                jtoth Justin Toth
                Reviewer:
                Hieu Pham
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-20120
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code