ClassCastException in Android when updating tableviews' rows

You must Login before you can answer or comment on any questions.

Details: Android 2.3.x, both on a Droid Incredible running Cyanogen Mod 7.2, and the simulator, running vanilla 2.3.4 on OSX.

I'm using SDK 2.1.1 GA

Note: The app runs beautifully on iOS, both in Simulator and in hardware. Thoroughly tested, as far as I can tell crash-free there.

I'm implementing the android side now and it is randomly crashing. It will work, and then crash generally on things happening in response to events fired through Ti.App.fireEvent - it looks as if refreshing the table views is causing the trouble. But not always! It will work a few times and then on the fourth ( or 1st, or 9th ) time it will crash.

But, why?

Here's the stack trace from the console:

[ERROR][TiApplication(  895)] (main) [8206,65185] Sending event: exception on thread: main msg:java.lang.ClassCastException: ti.modules.titanium.ui.widget.TiView; Titanium 2.1.1,2012/07/27 14:01,0fd84a2
[ERROR][TiApplication(  895)] java.lang.ClassCastException: ti.modules.titanium.ui.widget.TiView
[ERROR][TiApplication(  895)]   at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.refreshOldStyleRow(TiTableViewRowProxyItem.java:182)
[ERROR][TiApplication(  895)]   at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:282)
[ERROR][TiApplication(  895)]   at ti.modules.titanium.ui.TableViewRowProxy.handleMessage(TableViewRowProxy.java:166)
[ERROR][TiApplication(  895)]   at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR][TiApplication(  895)]   at android.os.Looper.loop(Looper.java:130)
[ERROR][TiApplication(  895)]   at android.app.ActivityThread.main(ActivityThread.java:3683)
[ERROR][TiApplication(  895)]   at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][TiApplication(  895)]   at java.lang.reflect.Method.invoke(Method.java:507)
[ERROR][TiApplication(  895)]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
[ERROR][TiApplication(  895)]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
[ERROR][TiApplication(  895)]   at dalvik.system.NativeStart.main(Native Method)
[ERROR][AndroidRuntime(  895)] FATAL EXCEPTION: main
[ERROR][AndroidRuntime(  895)] java.lang.ClassCastException: ti.modules.titanium.ui.widget.TiView
[ERROR][AndroidRuntime(  895)]  at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.refreshOldStyleRow(TiTableViewRowProxyItem.java:182)
[ERROR][AndroidRuntime(  895)]  at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:282)
[ERROR][AndroidRuntime(  895)]  at ti.modules.titanium.ui.TableViewRowProxy.handleMessage(TableViewRowProxy.java:166)
[ERROR][AndroidRuntime(  895)]  at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR][AndroidRuntime(  895)]  at android.os.Looper.loop(Looper.java:130)
[ERROR][AndroidRuntime(  895)]  at android.app.ActivityThread.main(ActivityThread.java:3683)
[ERROR][AndroidRuntime(  895)]  at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][AndroidRuntime(  895)]  at java.lang.reflect.Method.invoke(Method.java:507)
[ERROR][AndroidRuntime(  895)]  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
[ERROR][AndroidRuntime(  895)]  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
[ERROR][AndroidRuntime(  895)]  at dalvik.system.NativeStart.main(Native Method)

Your Answer

Think you can help? Login to answer this question!