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

Android: Crash when hintText value is numeric

    Details

    • Sprint:
      2014 Sprint 09 Tooling

      Description

      Problem Description

      Apps will crash when we set hint text to a numeric value in textbox after opening window.

      Looks like error is from:
      https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIText.java#L233

      Test Environment

      Ti SDK 3.2.1.GA
      Ti CLI 3.2.1
      Android 4.4.2

      Test Code

      index.xml

      <Alloy>
          <Window class="container">
              <Label id="label" top="30" onClick="doError">throw error</Label>
              <Label id="label" top="10" onClick="doNoError">no error</Label>
              <TextField id="txtField" hintText="123"/>
          </Window>
      </Alloy>
      

      index.js

      function doError(e) {
          $.txtField.hintText=456;
      }
      function doNoError(e) {
          $.txtField.hintText='789';
      }
       
      $.index.open();
      

      Steps to reproduce:
      1. Create new allow project 3.2.1.GA
      2. Update test code to index.js and index.xml file
      3. Launch in android; press label 'throw error'

      Error Logs

      [WARN] :   dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa4c3d648)
      [ERROR] :  TiApplication: (main) [15493,15493] Sending event: exception on thread: main msg:java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String; Titanium 3.2.1,2014/02/06 17:03,991027b
      [ERROR] :  TiApplication: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
      [ERROR] :  TiApplication:   at ti.modules.titanium.ui.widget.TiUIText.propertyChanged(TiUIText.java:233)
      [ERROR] :  TiApplication:   at org.appcelerator.kroll.KrollPropertyChange.fireEvent(KrollPropertyChange.java:21)
      [ERROR] :  TiApplication:   at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1059)
      [ERROR] :  TiApplication:   at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:327)
      [ERROR] :  TiApplication:   at ti.modules.titanium.ui.TextFieldProxy.handleMessage(TextFieldProxy.java:111)
      [ERROR] :  TiApplication:   at android.os.Handler.dispatchMessage(Handler.java:95)
      [ERROR] :  TiApplication:   at android.os.Looper.loop(Looper.java:137)
      [ERROR] :  TiApplication:   at android.app.ActivityThread.main(ActivityThread.java:5103)
      [ERROR] :  TiApplication:   at java.lang.reflect.Method.invokeNative(Native Method)
      [ERROR] :  TiApplication:   at java.lang.reflect.Method.invoke(Method.java:525)
      [ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
      [ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
      [ERROR] :  TiApplication:   at dalvik.system.NativeStart.main(Native Method)
      

      Explanation of Error:

      http://stackoverflow.com/questions/8973381/why-cannot-cast-integer-to-string-in-java

        Attachments

          Activity

            People

            • Assignee:
              hpham Hieu Pham
              Reporter:
              mrahman Mostafizur Rahman
            • Watchers:
              10 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Source Code