{ "id": "125648", "key": "TIMOB-16426", "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": "16723", "description": "Windows Platform Support, ListView updates, Vector overlays in maps", "name": "Release 4.1.0", "archived": false, "released": true, "releaseDate": "2015-07-08" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-05-05T18:24:48.000+0000", "created": "2014-01-30T20:21:32.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "deleteItem", "listview,", "scrollEnd," ], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2015-06-09T19:07: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": "Steps to reproduce :\r\n1. Put the following code into app.js and run it\r\n{code}\r\n\r\nvar win=Ti.UI.createWindow({\r\n\tfullscreen:false\r\n});\r\nvar template={\r\n\tchildTemplates:[\r\n\t\t{\r\n\t\t\ttype:'Ti.UI.Label',\r\n\t\t\tbindId:'title'\r\n\t\t}\r\n\t]\r\n};\r\nvar items=[];\r\nfor(var k=0;k<500;k++){\r\n\titems.push({\r\n\t\tproperties:{\r\n\t\t\t\tsearchableText:'Click to delete '+k\r\n\t\t\t},\r\n\t\ttitle:{text:'Click to delete '+k}\r\n\t});\r\n}\r\n\r\nvar search=Ti.UI.createSearchBar();\r\n\r\nvar listView=Ti.UI.createListView({\r\n\ttemplates:{template:template},\r\n\tdefaultItemTemplate:'template',\r\n\tsections:[\r\n\t\t\t\tTi.UI.createListSection({\r\n\t\t\t\t\t\titems:items\r\n\t\t\t\t\t})\r\n\t\t\t],\r\n\tsearchView:search\r\n});\r\n\r\nlistView.addEventListener('itemclick',function(e){\r\n\r\n\tvar index=e.itemIndex;\r\n Ti.API.info(\"Index\" + index);\r\n\te.section.deleteItemsAt(index,1);\r\n});\r\nwin.add(listView);\r\nwin.open();\r\n{code}\r\n2. Perform a random search by typing any text (eg. xyhwssj ) into the search bar.\r\n3.Clear out the search bar completely.\r\n4.Scroll down to the last bottom end.\r\n5.Delete an item by clicking on any row/item.\r\n\r\nDescription:\r\nAfter searching for an item on the `listView` and scrolling down to the bottom last end, if you try to delete an item, the app will always crashes. This bug is producible only on android and not on IOS.\r\n\r\n*However, the app will not crash if the listView has not reached the scroll end yet and you delete an item* but it will still crash on random occasion should you, after performing a search, tried to scroll down to the last bottom row even without deleting", "attachment": [], "flagged": false, "summary": "Android: App crashes after performing search on listView, scrolling down to the last row and deleting a row", "creator": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "CLI version 3.2.0, Titanium SDK version 3.2.0.GA, Studio 3.2.0.2014", "closedSprints": [ { "id": 371, "state": "closed", "name": "2015 Sprint 08 SDK", "startDate": "2015-04-11T00:00:49.626Z", "endDate": "2015-04-24T12:00:00.000Z", "completeDate": "2015-04-28T15:02:06.073Z", "originBoardId": 114 }, { "id": 398, "state": "closed", "name": "2015 Sprint 09 SDK", "startDate": "2015-04-25T00:00:00.000Z", "endDate": "2015-05-09T00:00:00.000Z", "completeDate": "2015-05-11T14:11:17.028Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "290599", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I believe this is related to TIMOB-16079. You get an incorrect e.itemIndex for ListView on Android platform and deleting a non existent entry based on this index causes the crash. This problem is more likely to occur at the end of scroll as you are more likely to have a non existent index there. You can verify this issue by checking for itemIndex.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-31T07:32:26.000+0000", "updated": "2014-01-31T07:32:26.000+0000" }, { "id": "290622", "author": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Right, the index are not always right but it is more than that. Even if it gets the right index, the crash is still pretty much imminent, that is, even if the index number corresponds to the right item row number. For instance, if you scroll down to the bottom last row after canceling the search, and tried to delete any items, the app will crash even though the index number corresponds to the right item row.\r\n\r\n*The listView without a proper function able search field defeats the main purpose of its ability to hold large data at the first place*. Who would realy want to take the trouble of searching from a list of thousands of items just by scrolling?", "updateAuthor": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-31T16:29:50.000+0000", "updated": "2014-01-31T16:33:49.000+0000" }, { "id": "292074", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening and moving this ticket to engineering as I can reproduce this issue now on Android 4.2.2 device with the provided test case and exact steps. It is important to type something in the search bar, search and then clear the search bar to display all the 500 rows. You have to scroll to the bottom and then delete a row. You can delete any row and it does not have to be the last row.\r\n\r\nHere is the stack trace:\r\n[ERROR] : TiApplication: (main) [3285,34156] Sending event: exception on thread: main msg:java.lang.IndexOutOfBoundsException: Invalid index 499, size is 499; Titanium 3.2.0,2013/12/20 10:57,d9182d6\r\n[ERROR] : TiApplication: java.lang.IndexOutOfBoundsException: Invalid index 499, size is 499\r\n[ERROR] : TiApplication: \tat java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)\r\n[ERROR] : TiApplication: \tat java.util.ArrayList.get(ArrayList.java:304)\r\n[ERROR] : TiApplication: \tat ti.modules.titanium.ui.widget.listview.ListSectionProxy.getTemplateByIndex(ListSectionProxy.java:767)\r\n[ERROR] : TiApplication: \tat ti.modules.titanium.ui.widget.listview.TiListView$TiBaseAdapter.getItemViewType(TiListView.java:215)\r\n[ERROR] : TiApplication: \tat android.widget.HeaderViewListAdapter.getItemViewType(HeaderViewListAdapter.java:234)\r\n[ERROR] : TiApplication: \tat android.widget.AbsListView$RecycleBin.getScrapView(AbsListView.java:6309)\r\n[ERROR] : TiApplication: \tat android.widget.AbsListView.obtainView(AbsListView.java:2139)\r\n[ERROR] : TiApplication: \tat android.widget.ListView.makeAndAddView(ListView.java:1831)\r\n[ERROR] : TiApplication: \tat android.widget.ListView.fillDown(ListView.java:674)\r\n[ERROR] : TiApplication: \tat android.widget.ListView.fillSpecific(ListView.java:1332)\r\n[ERROR] : TiApplication: \tat android.widget.ListView.layoutChildren(ListView.java:1630)\r\n[ERROR] : TiApplication: \tat android.widget.AbsListView.onLayout(AbsListView.java:1994)\r\n[ERROR] : TiApplication: \tat android.view.View.layout(View.java:14008)\r\n[ERROR] : TiApplication: \tat android.view.ViewGroup.layout(ViewGroup.java:4373)\r\n[ERROR] : TiApplication: \tat android.widget.FrameLayout.onLayout(FrameLayout.java:448)\r\n[ERROR] : TiApplication: \tat ti.modules.titanium.ui.widget.listview.TiListView$ListViewWrapper.onLayout(TiListView.java:139)\r\n[ERROR] : TiApplication: \tat android.view.View.layout(View.java:14008)\r\n[ERROR] : TiApplication: \tat android.view.ViewGroup.layout(ViewGroup.java:4373)\r\n[ERROR] : TiApplication: \tat android.widget.RelativeLayout.onLayout(RelativeLayout.java:1021)\r\n[ERROR] : TiApplication: \tat android.view.View.layout(View.java:14008)\r\n[ERROR] : TiApplication: \tat android.view.ViewGroup.layout(ViewGroup.java:4373)\r\n[ERROR] : TiApplication: \tat org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578)\r\n[ERROR] : TiApplication: \tat android.view.View.layout(View.java:14008)\r\n[ERROR] : TiApplication: \tat android.view.ViewGroup.layout(ViewGroup.java:4373)\r\n[ERROR] : TiApplication: \tat org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578)\r\n[ERROR] : TiApplication: \tat android.view.View.layout(View.java:14008)\r\n[ERROR] : TiApplication: \tat android.view.ViewGroup.layout(ViewGroup.java:4373)\r\n[ERROR] : TiApplication: \tat android.widget.FrameLayout.onLayout(FrameLayout.java:448)\r\n[ERROR] : TiApplication: \tat android.view.View.layout(View.java:14008)\r\n[ERROR] : TiApplication: \tat android.view.ViewGroup.layout(ViewGroup.java:4373)\r\n[ERROR] : TiApplication: \tat android.widget.LinearLayout.setChildFrame(LinearLayout.java:1663)\r\n[ERROR] : TiApplication: \tat android.widget.LinearLayout.layoutVertical(LinearLayout.java:1521)\r\n[ERROR] : TiApplication: \tat android.widget.LinearLayout.onLayout(LinearLayout.java:1434)\r\n[ERROR] : TiApplication: \tat android.view.View.layout(View.java:14008)\r\n[ERROR] : TiApplication: \tat android.view.ViewGroup.layout(ViewGroup.java:4373)\r\n[ERROR] : TiApplication: \tat android.widget.FrameLayout.onLayout(FrameLayout.java:448)\r\n[ERROR] : TiApplication: \tat android.view.View.layout(View.java:14008)\r\n[ERROR] : TiApplication: \tat android.view.ViewGroup.layout(ViewGroup.java:4373)\r\n[ERROR] : TiApplication: \tat android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1892)\r\n[ERROR] : TiApplication: \tat android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1711)\r\n[ERROR] : TiApplication: \tat android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)\r\n[ERROR] : TiApplication: \tat android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)\r\n[ERROR] : TiApplication: \tat android.view.Choreograph\r\n[ERROR] : TiApplication: \tat android.view.Choreographer.doCallbacks(Choreographer.java:562)\r\n[ERROR] : TiApplication: \tat android.view.Choreographer.doFrame(Choreographer.java:532)\r\n[ERROR] : TiApplication: \tat android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)\r\n[ERROR] : TiApplication: \tat android.os.Handler.handleCallback(Handler.java:725)\r\n[ERROR] : TiApplication: \tat android.os.Handler.dispatchMessage(Handler.java:92)\r\n[ERROR] : TiApplication: \tat android.os.Looper.loop(Looper.java:137)\r\n[ERROR] : TiApplication: \tat android.app.ActivityThread.main(ActivityThread.java:5041)\r\n[ERROR] : TiApplication: \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n[ERROR] : TiApplication: \tat java.lang.reflect.Method.invoke(Method.java:511)\r\n[ERROR] : TiApplication: \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)\r\n[ERROR] : TiApplication: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)\r\n[ERROR] : TiApplication: \tat dalvik.system.NativeStart.main(Native Method)\r\n\r\n\r\n", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-09T06:21:43.000+0000", "updated": "2014-02-09T06:21:43.000+0000" }, { "id": "350597", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master PR: https://github.com/appcelerator/titanium_mobile/pull/6802", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-04-23T22:33:12.000+0000", "updated": "2015-04-23T22:33:12.000+0000" }, { "id": "354682", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix.\r\n\r\nApp does not crash for the case of this ticket.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.1.0.201505071004\r\nTi SDK : 4.1.0.v20150605164428\r\nTi CLI : 4.0.1\r\nAlloy : 1.6.0\r\nMAC Yosemite : 10.10.3\r\nAppc npm : 4.0.0\r\nAppc CLI : 4.0.2-rc2\r\nNode: v0.10.37\r\nDevice - Android 5.0.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-06-09T19:07:08.000+0000", "updated": "2015-06-09T19:07:08.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }