{ "id": "63253", "key": "TIMOB-2621", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11233", "name": "Release 1.6.0", "archived": true, "released": true, "releaseDate": "2011-02-23" } ], "resolution": { "id": "6", "description": "", "name": "Hold" }, "resolutiondate": "2011-04-15T03:25:04.000+0000", "created": "2011-04-15T03:25:04.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "crash", "defect", "regression", "release-1.6.0", "tableview" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-03T07:05:39.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

My app shows a list of games in a tableview. If there are more\nthan 20, it will page the output. By this, I mean that it loads the\nfirst 20, then will have a 'touch for more' row at the bottom. When\nthat is touched it will remove that row, and load 20 more. It loads\nthese by creating the row objects (each with a unique className)\nand then calling a setData on the uploaded rowData list after all\nof the rows are created and added to the list.

\n

This works fine on iOS AND on Android build version=1.4.2\ntimestamp=10/11/10 19:02 githash=425bc37, but I'm getting a weird\ncrash bug on the 1.5.1 General release (version=1.5.1\ntimestamp=12/16/10 16:25 githash=16bbb92) after loading the second\npage of games into the table. What happens is that I click the row\nto load more, more games are loaded (that works fine) and then as I\nscroll around (up or down), within 5-10 seconds the app will crash\nwith the following exception:

\n
\n[TRACE] D/AndroidRuntime( 628): Shutting down VM\n[TRACE] W/dalvikvm( 628): threadid=1: thread exiting with uncaught exception (group=0x4001d800)\n[TRACE] E/TiUncaughtHandler( 628): (main) [8606,794666] Sending event: exception on thread: main msg:java.lang.ArrayIndexOutOfBoundsException; Titanium 1.5.1,2010/12/16 16:25,6bbb92\n[TRACE] E/TiUncaughtHandler( 628): java.lang.ArrayIndexOutOfBoundsException\n[TRACE] E/TiUncaughtHandler( 628): at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:4078)\n[TRACE] E/TiUncaughtHandler( 628): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:2915)\n[TRACE] E/TiUncaughtHandler( 628): at android.widget.AbsListView.onTouchEvent(AbsListView.java:2065)\n[TRACE] E/TiUncaughtHandler( 628): at android.widget.ListView.onTouchEvent(ListView.java:3315)\n[TRACE] E/TiUncaughtHandler( 628): at android.view.View.dispatchTouchEvent(View.java:3766)\n[TRACE] E/TiUncaughtHandler( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:897)\n[TRACE] E/TiUncaughtHandler( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/TiUncaughtHandler( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/TiUncaughtHandler( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/TiUncaughtHandler( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/TiUncaughtHandler( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/TiUncaughtHandler( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/TiUncaughtHandler( 628): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1671)\n[TRACE] E/TiUncaughtHandler( 628): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)\n[TRACE] E/TiUncaughtHandler( 628): at android.app.Activity.dispatchTouchEvent(Activity.java:2086)\n[TRACE] E/TiUncaughtHandler( 628): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1655)\n[TRACE] E/TiUncaughtHandler( 628): at android.view.ViewRoot.handleMessage(ViewRoot.java:1785)\n[TRACE] E/TiUncaughtHandler( 628): at android.os.Handler.dispatchMessage(Handler.java:99)\n[TRACE] E/TiUncaughtHandler( 628): at android.os.Looper.loop(Looper.java:123)\n[TRACE] E/TiUncaughtHandler( 628): at android.app.ActivityThread.main(ActivityThread.java:4627)\n[TRACE] E/TiUncaughtHandler( 628): at java.lang.reflect.Method.invokeNative(Native Method)\n[TRACE] E/TiUncaughtHandler( 628): at java.lang.reflect.Method.invoke(Method.java:521)\n[TRACE] E/TiUncaughtHandler( 628): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)\n[TRACE] E/TiUncaughtHandler( 628): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)\n[TRACE] E/TiUncaughtHandler( 628): at dalvik.system.NativeStart.main(Native Method)\n[TRACE] I/TiApplication( 628): (main) [141,794807] Analytics are disabled, ignoring postAnalyticsEvent\n[TRACE] E/AndroidRuntime( 628): FATAL EXCEPTION: main\n[TRACE] E/AndroidRuntime( 628): java.lang.ArrayIndexOutOfBoundsException\n[TRACE] E/AndroidRuntime( 628): at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:4078)\n[TRACE] E/AndroidRuntime( 628): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:2915)\n[TRACE] E/AndroidRuntime( 628): at android.widget.AbsListView.onTouchEvent(AbsListView.java:2065)\n[TRACE] E/AndroidRuntime( 628): at android.widget.ListView.onTouchEvent(ListView.java:3315)\n[TRACE] E/AndroidRuntime( 628): at android.view.View.dispatchTouchEvent(View.java:3766)\n[TRACE] E/AndroidRuntime( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:897)\n[TRACE] E/AndroidRuntime( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/AndroidRuntime( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/AndroidRuntime( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/AndroidRuntime( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/AndroidRuntime( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/AndroidRuntime( 628): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)\n[TRACE] E/AndroidRuntime( 628): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1671)\n[TRACE] E/AndroidRuntime( 628): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)\n[TRACE] E/AndroidRuntime( 628): at android.app.Activity.dispatchTouchEvent(Activity.java:2086)\n[TRACE] E/AndroidRuntime( 628): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1655)\n[TRACE] E/AndroidRuntime( 628): at android.view.ViewRoot.handleMessage(ViewRoot.java:1785)\n[TRACE] E/AndroidRuntime( 628): at android.os.Handler.dispatchMessage(Handler.java:99)\n[TRACE] E/AndroidRuntime( 628): at android.os.Looper.loop(Looper.java:123)\n[TRACE] E/AndroidRuntime( 628): at android.app.ActivityThread.main(ActivityThread.java:4627)\n[TRACE] E/AndroidRuntime( 628): at java.lang.reflect.Method.invokeNative(Native Method)\n[TRACE] E/AndroidRuntime( 628): at java.lang.reflect.Method.invoke(Method.java:521)\n[TRACE] E/AndroidRuntime( 628): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)\n[TRACE] E/AndroidRuntime( 628): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)\n[TRACE] E/AndroidRuntime( 628): at dalvik.system.NativeStart.main(Native Method)\n
\n

This ONLY happens after loading an additional page of results\n(which at that point I have 40 rows, with 40 different class\nnames). It also only happens when I am using unique class names for\neach row. If I use the same className, I don't get the crash,\nhowever I need unique classnames as I will modify the row label\ncolors on a per-row basis when clicked (if I don't have this, I'll\nget weird undefined results).

\n

Given the nature of this bug, I'm not so sure I can develop a\ntest case for it. I did find the following:
\n\nhttp://kevinmorey.com/post/990223225/arrayindexoutofboundsexception...\n\nhttp://stackoverflow.com/questions/2596547/arrayindexoutofboundsexc...

\n

Perhaps one of those may point in the right direction. I can\nprovide access to my code if necessary to aid with fixing of the\nbug.

{html}", "attachment": [], "flagged": false, "summary": "Android: App crashes with paged tableview (1.5.x regression)", "creator": { "name": "robby", "key": "robby", "displayName": "Robby", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "robby", "key": "robby", "displayName": "Robby", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "129006", "author": { "name": "robby", "key": "robby", "displayName": "Robby", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Did some further experimentation: This bug has nothing to do\nwith the paging of the tableview. As an attempted workaround, I\nmodified the code to load all 50 (in this case) rows at once (e.g.\ncreate 50 rows, add to rowData list, do a single setData() call),\nand still ran into the same bug when scrolling. My thinking is that\nthere is some kind of bug that imposes a \"limit\" with the number of\nunique className values. If you go over that \"limit\", this bug\nmanifests.

{html}", "updateAuthor": { "name": "robby", "key": "robby", "displayName": "Robby", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:25:04.000+0000", "updated": "2011-04-15T03:25:04.000+0000" }, { "id": "129007", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Couple of things. 1, you're going to get very slow performance\nwith unique classNames per row. It effectively means that you're\ngoing to use a ton of memory and won't be able to show many rows in\nthe long run.

\n

The tableview is currently maxed out at 32 unique classnames 3\nof which are reserved for internal use.

\n

Try going back to using unique classNames, but make sure you put\ndefaults on every row. For example. If you're changing text color\non the label. Make sure you put that property on every row with a\ndefault value.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:25:05.000+0000", "updated": "2011-04-15T03:25:05.000+0000" }, { "id": "129008", "author": { "name": "robby", "key": "robby", "displayName": "Robby", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Thanks Don...good to know I was on track with what the problem\nwas. If you decide to keep this limit, perhaps raising a more\nexplicit exception when running into too many classNames may\nhelp.

\n

Changing text label color and row backgroundColor on click (to\nshow the row as \"selected\") is why I use the unique classNames,\nactually. I'd love to avoid using unique ones actually, if at all\npossible. I tried modifying the className to a \"gameRowSelected\"\nvalue when it was selected (so I effectively have 2 classNames\ntotal) but that doesn't work...still get weird unpredictable\nresults...guessing you can't modify className dynamically like\nthat.

\n

So if I have Labels on my rows that I need to modify the color\nof on a row by row basis, I basically have to use unique\nclassNames?

{html}", "updateAuthor": { "name": "robby", "key": "robby", "displayName": "Robby", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:25:05.000+0000", "updated": "2011-04-15T03:25:05.000+0000" }, { "id": "129009", "author": { "name": "robby", "key": "robby", "displayName": "Robby", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Also, if you say that the max # of unique classNames is 32 - 3,\nthen I'm kind of at a deadend if I use unique classNames (since\nmany of my screens have > 29 rows). Does that putting the\ndefaults on every row effectively \"get around\" this issue, though?\nJust a bit confused on what the best approach is here....

{html}", "updateAuthor": { "name": "robby", "key": "robby", "displayName": "Robby", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:25:05.000+0000", "updated": "2011-04-15T03:25:05.000+0000" }, { "id": "129010", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Rows get reused if they have the same className. That allows for\nbetter memory utilization by have at most n+2 rows view hierarchy\nallocated to that className. Where n is the max number of rows\nvisible on the screen at any one time for that className. Since\nyou're changing attributes on the rows, you should be able to use a\nsingle className, but make sure that each row has the full set of\nattributes you want to control. For example if you're setting color\non a text view to red and that row is scrolled off the screen, we\nneed a color to set the row to when its views are used to display\nanother rows worth of data.

\n

I haven't tested this, but you might be able to have a two\nclassNames one for selected rows and one for the rest. Then update\nthe selected row to use the new selected row className so that when\nyou scroll around, the row proxies (TableViewRow) have the\nappropriate className and will draw correctly.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:25:05.000+0000", "updated": "2011-04-15T03:25:05.000+0000" }, { "id": "129011", "author": { "name": "seanmccullough", "key": "seanmccullough", "displayName": "Sean McCullough", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I am having this error: \nhttp://developer.appcelerator.com/question/110421/repeating-dataind...

\n

Is there a solution to showing more than 29 unique rows of\ndata?

{html}", "updateAuthor": { "name": "seanmccullough", "key": "seanmccullough", "displayName": "Sean McCullough", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:25:06.000+0000", "updated": "2011-04-15T03:25:06.000+0000" }, { "id": "408828", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket due to time passed and irrelevance. ", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-03T07:05:39.000+0000", "updated": "2017-03-03T07:05:39.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }