Index out of bound
Hello
I am converting my iPhone app to Android.
I'm having a problem with my tableview. I can populate it correctly and it loads perfectly. Now when I scroll it crashes with the error:
W/dalvikvm( 774): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/TiUncaughtHandler( 774): (main) [6622,317311] Sending event: exception on thread: main msg:java.lang.ArrayIndexOutOfBoundsException; Titanium 1.7.2,2011/07/21 09:36,97c3689
E/TiUncaughtHandler( 774): java.lang.ArrayIndexOutOfBoundsException
E/TiUncaughtHandler( 774): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProxies(TiTableViewRowProxyItem.java:158)
E/TiUncaughtHandler( 774): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.refreshControls(TiTableViewRowProxyItem.java:138)
E/TiUncaughtHandler( 774): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:273)
E/TiUncaughtHandler( 774): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:77)
E/TiUncaughtHandler( 774): at ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(TiTableView.java:204)
What could this ArrayIndexOutOfBoundsException be? Where do I have to look for it? How can I locate where the problem occurs?
I haven't used any array's except the data for the tableview.
But the strange this is that this problem only happens when I start scrolling down. Can anyone give me a bit more explanation about this error? I thought the outofbound exception only could occur if you call a place in the array larger than the array itself? But since all the data is already loaded I'm guessing that couldn't be the problem?
I'm using Titanium SDK 1.7.2.
Thanks in advance!
Tjeu
6 Answers
-
I resolved this bug with disabling the classname attribute on the rows of the tableview.
-
Im also having this issue. I build a custom row that can have different views depending on the data. I have removed the classname property but I still get the following error when scrolling:
08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): (main) [2971,12720] Sending event: exception on thread: main msg:java.lang.ArrayIndexOutOfBoundsException; Titanium 1.7.2,2011/07/21 09:36,97c3689 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): java.lang.ArrayIndexOutOfBoundsException 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProxies(TiTableViewRowProxyItem.java:158) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProxies(TiTableViewRowProxyItem.java:161) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.refreshControls(TiTableViewRowProxyItem.java:138) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:273) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:77) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(TiTableView.java:204) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.widget.AbsListView.obtainView(AbsListView.java:1336) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.widget.ListView.makeAndAddView(ListView.java:1781) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.widget.ListView.fillDown(ListView.java:654) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.widget.ListView.fillGap(ListView.java:625) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:3010) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:2542) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.os.Handler.handleCallback(Handler.java:587) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.os.Handler.dispatchMessage(Handler.java:92) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.os.Looper.loop(Looper.java:143) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at android.app.ActivityThread.main(ActivityThread.java:5073) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at java.lang.reflect.Method.invokeNative(Native Method) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at java.lang.reflect.Method.invoke(Method.java:521) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 08-19 13:41:19.863: ERROR/TiUncaughtHandler(20924): at dalvik.system.NativeStart.main(Native Method) 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): FATAL EXCEPTION: main 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): java.lang.ArrayIndexOutOfBoundsException 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProxies(TiTableViewRowProxyItem.java:158) 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProxies(TiTableViewRowProxyItem.java:161) 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.refreshControls(TiTableViewRowProxyItem.java:138) 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:273) 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:77) 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): at ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(TiTableView.java:204) 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220) 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): at android.widget.AbsListView.obtainView(AbsListView.java:1336) 08-19 13:41:19.883: ERROR/AndroidRuntime(20924): at android.widget.ListView.makeAndAddView(ListView.java:1781)
etc…..
-
Have you added Scroll event for tableView??????
Can u please post the code…
Regards,
MONY -
I'm using Titanium Mobile 2.0.1.GA2, and I also solved this problem by removing the classname attribute of createTableViewRow. Thanks for the solution.
-
Yes, it's className problem.
-
yes className is creating the havoc.. while scolling the tableview…..so please remove className property