java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

Appcelerator JIRA | Mostafizur Rahman | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    h5. 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 h5. Test Environment Ti SDK 3.2.1.GA Ti CLI 3.2.1 Android 4.4.2 h5. Test Code index.xml {code} <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> {code} index.js {code} function doError(e) { $.txtField.hintText=456; } function doNoError(e) { $.txtField.hintText='789'; } $.index.open(); {code} h5. Steps to reproduce: # Create new allow project 3.2.1.GA # Update test code to index.js and index.xml file # Launch in android; press label 'throw error' h3. Error Logs {code} [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) {code} h3. Explanation of Error: http://stackoverflow.com/questions/8973381/why-cannot-cast-integer-to-string-in-java

    Appcelerator JIRA | 3 years ago | Mostafizur Rahman
    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
  2. 0

    h5. 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 h5. Test Environment Ti SDK 3.2.1.GA Ti CLI 3.2.1 Android 4.4.2 h5. Test Code index.xml {code} <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> {code} index.js {code} function doError(e) { $.txtField.hintText=456; } function doNoError(e) { $.txtField.hintText='789'; } $.index.open(); {code} h5. Steps to reproduce: # Create new allow project 3.2.1.GA # Update test code to index.js and index.xml file # Launch in android; press label 'throw error' h3. Error Logs {code} [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) {code} h3. Explanation of Error: http://stackoverflow.com/questions/8973381/why-cannot-cast-integer-to-string-in-java

    Appcelerator JIRA | 3 years ago | Mostafizur Rahman
    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.Integer cannot be cast to java.lang.String

      at ti.modules.titanium.ui.widget.TiUIText.propertyChanged()
    2. ti.modules.titanium
      TiUIText.propertyChanged
      1. ti.modules.titanium.ui.widget.TiUIText.propertyChanged(TiUIText.java:233)
      1 frame
    3. org.appcelerator.kroll
      KrollProxy.handleMessage
      1. org.appcelerator.kroll.KrollPropertyChange.fireEvent(KrollPropertyChange.java:21)
      2. org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1059)
      2 frames
    4. org.appcelerator.titanium
      TiViewProxy.handleMessage
      1. org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:327)
      1 frame
    5. ti.modules.titanium
      TextFieldProxy.handleMessage
      1. ti.modules.titanium.ui.TextFieldProxy.handleMessage(TextFieldProxy.java:111)
      1 frame
    6. Android Platform
      ActivityThread.main
      1. android.os.Handler.dispatchMessage(Handler.java:95)
      2. android.os.Looper.loop(Looper.java:137)
      3. android.app.ActivityThread.main(ActivityThread.java:5103)
      3 frames
    7. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invokeNative(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:525)
      2 frames
    8. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
      2 frames
    9. Android Platform
      NativeStart.main
      1. dalvik.system.NativeStart.main(Native Method)
      1 frame