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

Android: showDatePickerDialog cancel property always false and callback called twice

    Details

    • Type: Bug
    • Status: Open
    • Priority: None
    • Resolution: Unresolved
    • Affects Version/s: Release 3.3.0
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      Android
      Tested with
      Titanium SDK 3.3.0
      Genymotion nexus 7 (2013)
      LG G Tab 8.3

      Description

      Problem Description

      On android the datepicker always returns "cancel:false" (if you cancel or accept)

      If you press cancel (back button or press outside the modal popup)
      the function callback gets called 1time

      if you accept the date
      the function callback gets called 2 times

      Steps to reproduce

      • Create a simple project.
      • Paste the testcase into app.js
      • Run on android tab

      Testcase

      var win = Ti.UI.createWindow({title:'test'});
      win.open();
      var picker = Ti.UI.createPicker({value : new Date(),type: Ti.UI.PICKER_TYPE_DATE});
      var pickDateButton = Ti.UI.createButton({title:'pick a date'});
      win.add(pickDateButton);
      pickDateButton.addEventListener('click',function(){
          picker.showDatePickerDialog({
              value:new Date(),
              callback:function(e){
                  Ti.API.info('picked date: '+JSON.stringify(e));
              }
          });
      });
      

      Workaround

      To avoid this bug I ignore the cancel property in the callback, and I check how many times the callback function gets executed.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bar b Bar Bruy
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

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

                  Git Integration