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

Android: showTimePickerDialog does appear if you didn't added the picker before.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: None
    • Resolution: Fixed
    • Affects Version/s: Release 3.3.0, Release 3.4.0
    • Fix Version/s: Release 6.2.0
    • Component/s: Android
    • Labels:
    • Environment:

      MacOSX: OSX Mavericks,
      Mobile SDK: 3.4.0 (Beta), 3.3.0.GA
      Android: Genymotion Android 4.3 emulator
      Devices: LG G2 device, Nexus 5 Android 4.4.2

      Description

      Problem Description

      showTimePickerDialog doesn't work if you don't add the picker before to the window.

      Steps to reproduce

      1. Create a new mobile project
      2. Add this testcase to app.js:

      var win = Ti.UI.createWindow({
          exitOnClose: true
      });
       
      var picker = Ti.UI.createPicker({
          type: Ti.UI.PICKER_TYPE_TIME
      });
       
      var btn = Ti.UI.createButton({
          title : 'Show time picker dialog'
      });
       
      win.add( btn );
      win.open( );
       
      btn.addEventListener( 'singletap', function( ) {
          picker.showTimePickerDialog({
              callback: function( e ) {
                  if ( e.cancel ) {
                      Ti.API.info( 'User canceled dialog' );
                  } else {
                      Ti.API.info( 'User selected time: ' + e.value );
                  }
              }
          });
      });
      

      Console output message:

      [WARN]  HardwareRenderer: Attempting to initialize hardware acceleration outside of the main thread, aborting
      

      3. Run it in device.
      4. Click on show the picker.

      Workaround

      Set the left element to -1000 (or any negative number outside of the screen, and add the picker to the window.

      var win = Ti.UI.createWindow({
          exitOnClose : true,
          layout : 'vertical'
      });
        
      var picker = Ti.UI.createPicker({
          type : Titanium.UI.PICKER_TYPE_TIME,
          top : 10,
          left:-1000,
      });
        
      win.add(picker);
       
      var btn = Ti.UI.createButton({
          title : 'Show time picker dialog',
          top : 10
      });
        
      win.add(btn);
      //win.add(picker);
      win.open();
        
      btn.addEventListener('singletap', function() {
          picker.showTimePickerDialog({
              callback : function(e) {
                  if (e.cancel) {
                      Ti.API.info('User canceled dialog');
                  } else {
                      Ti.API.info('User selected time: ' + e.value);
                  }
              }
          });
        
      });
      

        Attachments

          Activity

            People

            • Assignee:
              lchoudhary Lokesh Choudhary
              Reporter:
              joseandro Joseandro Luiz
              Reviewer:
              Joshua Quick
              Tester:
              Samir Mohammed
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code