Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14546] Android: ListView appendSection to empty ListView throws exception

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-04-09T21:39:29.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, listview, parity, triage
ReporterMark Mokryn
AssigneeHieu Pham
Created2013-07-12T11:18:59.000+0000
Updated2017-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);

Comments

  1. Daniel Sefton 2013-07-12

    Tested and confirmed on Samsung Galaxy S2 2.3.6 with Ti SDK 3.2 CI.
  2. Mark Mokryn 2014-04-09

    Any update? Was bitten by this again on 3.2.2.GA.....
  3. Hieu Pham 2014-04-09

    I can't reproduce this on master. Closing as unable to reproduce.
  4. Hieu Pham 2014-04-09

    Mark, please try on latest master. This issue should be fixed.
  5. Mark Mokryn 2014-04-09

    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?
  6. Ingo Muschenetz 2014-04-09

    [~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.
  7. Lee Morris 2017-03-30

    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

JSON Source