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

Android: showDatePickerDialog and showTimePickerDialog can't be cancelled

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 4.0.0
    • Component/s: Android
    • Labels:
    • Environment:

      Android 4.2.2 (probably Android 4+)
      Galaxy Nexus
      Titanium SDK 3.1.0, 2.1.4, 2.0.1, etc

    • Story Points:
      5
    • Sprint:
      2014 Sprint 24 SDK

      Description

      The callback of showDatePickerDialog and showTimePickerDialog always return with the cancel property set to false. It doesn't matter if you press the back button or press outside the modal dialog, cancel gets never true.

      Furthermore, if you click on the Set/Ok/Done/Ready button, the callback is called twice.

      Note that in the picker dialog, we have only a single button "Set", so no Cancel button. This is fine as you should be able to cancel dialog with the back button. Clicking the back button fires wrongly a success (cancel=false) event.

      Example code

      		var picker = Ti.UI.createPicker( {
      		    type : Ti.UI.PICKER_TYPE_TIME
      		});
      		 
      		picker.showDatePickerDialog({
      		    callback: function(e) {
      		        if (e.cancel) {
      		            Ti.API.info('user canceled dialog');
      		        } else {
      		            Ti.API.info('user selected date: ' + e.value);
      		        }
      		    }
      		});
      

      Problem does not occur on older Android devices, like Android 2.3.

      See https://github.com/markruys/titanium-test-picker for a working project to reproduce.

        Attachments

          Activity

            People

            • Assignee:
              msamah Ashraf Abu (Inactive)
              Reporter:
              clathrop Carter Lathrop
              Reviewer:
              Hieu Pham
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Integration