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

Android: Setting "visible" to null on View causes exception

    Details

      Description

      problem

      When setting the visible property of a Ti.UI.View to null it causes a runtime exception on android. On iOS and Mobileweb the view would simply become invisible. I'm not certain whether it should be visible or invisible, but they should be the same behavior regardless of platform.

      expected

      When I set the the visible property of a Ti.UI.Label to null, I expect the behavior, whether it makes the view visible or invisible, to be the same on all platforms. It should not cause a runtime exception

      test case

      app.js

      var win = Ti.UI.createWindow({
      	backgroundColor: '#fff',
      	modal: false,
      	exitOnClose: true
      });
      var label = Ti.UI.createLabel({
      	text: 'just a test label'
      });
      label.addEventListener('click', function(e) {
      	label.visible = null;
      });
       
      win.add(label);
      win.open();
      

      error log (adb)

      W/dalvikvm(  486): threadid=1: thread exiting with uncaught exception (group=0x40015560)
      E/TiApplication(  486): (main) [1415,31700] Sending event: exception on thread: main msg:java.lang.IllegalArgumentException: Unable to convert null to boolean.; Titanium 3.1.1,2013/06/15 16:10,f7592c1
      E/TiApplication(  486): java.lang.IllegalArgumentException: Unable to convert null to boolean.
      E/TiApplication(  486): 	at org.appcelerator.titanium.util.TiConvert.toBoolean(TiConvert.java:356)
      E/TiApplication(  486): 	at org.appcelerator.titanium.view.TiUIView.propertyChanged(TiUIView.java:543)
      E/TiApplication(  486): 	at ti.modules.titanium.ui.widget.TiUILabel.propertyChanged(TiUILabel.java:168)
      E/TiApplication(  486): 	at org.appcelerator.kroll.KrollPropertyChange.fireEvent(KrollPropertyChange.java:21)
      E/TiApplication(  486): 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1011)
      E/TiApplication(  486): 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:316)
      E/TiApplication(  486): 	at android.os.Handler.dispatchMessage(Handler.java:95)
      E/TiApplication(  486): 	at android.os.Looper.loop(Looper.java:130)
      E/TiApplication(  486): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
      E/TiApplication(  486): 	at java.lang.reflect.Method.invokeNative(Native Method)
      E/TiApplication(  486): 	at java.lang.reflect.Method.invoke(Method.java:507)
      E/TiApplication(  486): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
      E/TiApplication(  486): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
      E/TiApplication(  486): 	at dalvik.system.NativeStart.main(Native Method)
      E/AndroidRuntime(  486): FATAL EXCEPTION: main
      E/AndroidRuntime(  486): java.lang.IllegalArgumentException: Unable to convert null to boolean.
      E/AndroidRuntime(  486): 	at org.appcelerator.titanium.util.TiConvert.toBoolean(TiConvert.java:356)
      E/AndroidRuntime(  486): 	at org.appcelerator.titanium.view.TiUIView.propertyChanged(TiUIView.java:543)
      E/AndroidRuntime(  486): 	at ti.modules.titanium.ui.widget.TiUILabel.propertyChanged(TiUILabel.java:168)
      E/AndroidRuntime(  486): 	at org.appcelerator.kroll.KrollPropertyChange.fireEvent(KrollPropertyChange.java:21)
      E/AndroidRuntime(  486): 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1011)
      E/AndroidRuntime(  486): 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:316)
      E/AndroidRuntime(  486): 	at android.os.Handler.dispatchMessage(Handler.java:95)
      E/AndroidRuntime(  486): 	at android.os.Looper.loop(Looper.java:130)
      E/AndroidRuntime(  486): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
      E/AndroidRuntime(  486): 	at java.lang.reflect.Method.invokeNative(Native Method)
      E/AndroidRuntime(  486): 	at java.lang.reflect.Method.invoke(Method.java:507)
      E/AndroidRuntime(  486): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
      E/AndroidRuntime(  486): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
      E/AndroidRuntime(  486): 	at dalvik.system.NativeStart.main(Native Method)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bijuexalture Biju pm
                Reporter:
                tlukasavage Tony Lukasavage
                Reviewer:
                Vishal Duggal (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code