[TIMOB-14546] Android: ListView appendSection to empty ListView throws exception
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2014-04-09T21:39:29.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android, listview, parity, triage |
Reporter | Mark Mokryn |
Assignee | Hieu Pham |
Created | 2013-07-12T11:18:59.000+0000 |
Updated | 2017-03-30T21:20:44.000+0000 |
Description
*Problem*
Self explanatory - the following code crashes on Android but works fine on iOS simulator. Similar to TIMOB-14545, looks like there are issues initializing the ListView arrays in Android.
*Test case*
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
var listView = Ti.UI.createListView({
top : '150dp'
});
var btn = Ti.UI.createButton({
top : '2dp',
width : '300dp',
height : '40dp',
title : 'Android appendSection bug'
});
btn.addEventListener('click', function() {
listView.removeAllChildren();
var fruitSection = Ti.UI.createListSection({
headerTitle : 'Fruits'
});
listView.appendSection(fruitSection);
alert('Section header title: ' + listView.sections[0].headerTitle);
});
win.add(btn);
win.add(listView);
win.open();
*Error message*
Location:
[20,55] app.js
Message:
Uncaught TypeError: Cannot read property '0' of undefined
Source:
alert('Section header title: ' + listView.sections[0].headerTitle);
Tested and confirmed on Samsung Galaxy S2 2.3.6 with Ti SDK 3.2 CI.
Any update? Was bitten by this again on 3.2.2.GA.....
I can't reproduce this on master. Closing as unable to reproduce.
Mark, please try on latest master. This issue should be fixed.
Indeed on 3.3.0 it's OK, but it's buggy on 3.2.2.GA. Since 3.3.0 is a long ways off, why not backport the fix to 3.2.x, and why don't you guys track the fixes on JIRA?
[~mokesmokes] We do track the fixes on JIRA, but this appears to have been fixed as a result of some other commit. If we knew which one fixed it, we would backport it, but that could be a substantial effort to locate it.
Closing ticket as I am unable to reproduce the issue using the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80