{ "id": "107060", "key": "TIMOB-12450", "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": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2017-07-26T04:21:13.000+0000", "created": "2012-12-23T15:46:40.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "exalture" ], "versions": [ { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" } ], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-07-26T04:21:13.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": "h1. Problem description\r\n\r\nAdding a view to a row on the fly, if the row has className enabled, results in a crash as soon as the table scrolls.\r\n\r\nh1. Comments\r\n\r\nLets say you want to implement a menu on row. The \"lighter\" way is to add the menu when necessary and remove it as soon as possible.\r\n\r\nIf you are using the 'className' property of the row then a crash occurs while scrolling (reuse of a cell).\r\n\r\nIf you remove the className property in the code below, then it works.\r\n\r\nIn more complex code of mine I can see that the reuse works perfectly without className. So using className should work as well (even better).\r\n\r\nh1. Steps to reproduce\r\n\r\nUse the following code; click on a row, then scroll down to see the crash.\r\n\r\n{code}\r\nvar win = Titanium.UI.createWindow();\r\nwin.backgroundColor = '#ccc';\r\n\r\nvar tableview = Ti.UI.createTableView();\r\nwin.add(tableview);\r\n\r\nvar rowData = [];\r\nfor (var i = 0; i < 100; i++) {\r\n\tvar row = Ti.UI.createTableViewRow({\r\n\t\ttitle : 'row ' + i,\r\n\t\theight : 90,\r\n\t\tclassName : 'myrow'\r\n\t});\r\n\trow.view = Ti.UI.createView({\r\n\t\tleft : 0,\r\n\t\tright : 0,\r\n\t\ttop : 0,\r\n\t\tbottom : 0,\r\n\t\tbackgroundColor : 'blue'\r\n\t})\r\n\trow.add(row.view);\r\n\trowData.push(row);\r\n};\r\ntableview.data = rowData;\r\n\r\ntableview.addEventListener('click', function(e) {\r\n\tif (e.row) {\r\n\t\tTi.API.info('testing ')\r\n\t\tif (!e.row.menu || e.row.menu === null) {\r\n\t\t\te.row.menu = Ti.UI.createView({\r\n\t\t\t\twidth : 50,\r\n\t\t\t\tright : 0,\r\n\t\t\t\tbackgroundColor : 'black'\r\n\t\t\t})\r\n\t\t\te.row.view.add(e.row.menu);\r\n\t\t} else {\r\n\t\t\te.row.view.remove(e.row.menu);\r\n\t\t\te.row.menu = null;\r\n\t\t}\r\n\t}\r\n})\r\n\r\nwin.open();\r\n{code}\r\n\r\nThe error reported:\r\n\r\nE/TiApplication( 4545): java.lang.ArrayIndexOutOfBoundsException: length=0; index=0\r\nE/TiApplication( 4545): \tat ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.applyChildProperties(TiTableViewRowProxyItem.java:176)\r\n", "attachment": [], "flagged": false, "summary": "Android: TableViewRow with className crash when adding a view and scrolling", "creator": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "farfromrefuge", "key": "farfromrefuge", "displayName": "Martin Guillon", "active": false, "timeZone": "Europe/Berlin" }, "environment": "Titanium 3.1.0 master\r\nAndroid SDK 17", "comment": { "comments": [ { "id": "242437", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Issue reproduces with\n\nTitanium Studio, build: 3.0.1.201212181159\nTitanium SDK version: 3.1.0 (03/11/13 15:43 0c88429)\nTitanium SDK version: 3.0.2 (02/07/13 16:46 a4def81)\nDevice: Samsung galaxy s duos Android version: 4.0.4\n\njithinpv", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-15T12:08:24.000+0000", "updated": "2013-03-15T12:08:24.000+0000" }, { "id": "259331", "author": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "body": "The issue cannot reproduce with the release master 3.2.0\nTested with: \nTitanium SDK version: 3.2.0\nTested on\nDevice: Samsung galaxy s duos Android version: 4.0.4 ", "updateAuthor": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-06-25T06:22:20.000+0000", "updated": "2013-06-25T06:22:20.000+0000" }, { "id": "325168", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I couldn't reproduce the issue with latest master. \r\nDevice Nexus 4.3", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-09-23T16:21:53.000+0000", "updated": "2014-09-23T16:21:53.000+0000" }, { "id": "424740", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I am unable to reproduce this issue with the following environment;\r\nPixel (7.1)\r\nStudio 4.9.0.201705302345\r\nTi SDK 6.1.1 GA\r\nAppc NPM 4.2.9\r\nAppc CLI 6.2.2\r\nTi CLI 5.0.14\r\nAlloy 1.9.11\r\nXcode 8.2 (8C38)\r\nNode v4.8.2\r\nJava 1.8.0_131", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-07-26T04:21:13.000+0000", "updated": "2017-07-26T04:21:13.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }