[TIMOB-14018] Android: 'longpress' on tableView with headerView but no headerTitle returns incorrect index and might lead to a crash
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2013-05-29T20:53:47.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | n/a |
Components | n/a |
Labels | regression |
Reporter | Jick Steen |
Assignee | Ingo Muschenetz |
Created | 2013-05-29T11:14:20.000+0000 |
Updated | 2017-03-21T22:56:35.000+0000 |
Description
I've already added a comment on TIMOB-12114 but I do not have the permission to reopen it because it is already resolved.
The app is still crashing on 3.2.0.v20130522115134 build if you remove the headerTitle. Tried it on a Samsung Galaxy S2 with Android 4.1.2.
Looks like it is crashing even if you haven't added a longpress event listener. That means once a user does a longpress on any row, the Android app crashes.
Link to Q&A discussion: http://developer.appcelerator.com/question/152977/android-longpress-on-tableview-with-headerview-returns-incorrect-index-and-might-lead-to-a-crash
Code to reproduce:
var _self = Ti.UI.createWindow({
backgroundColor : '#fff',
height : Ti.UI.FILL,
width : Ti.UI.FILL
});
_self.open();
var table = Ti.UI.createTableView({
//headerTitle : "title" // Remove to fix
});
var headerView = Ti.UI.createView({
backgroundColor : '#444',
visible : false,
height : 0
});
var titleLabel = Ti.UI.createLabel({
width : _self.width,
textAlign : 'center',
color : '#eee',
text : "Title text"
});
headerView.add(titleLabel);
table.setHeaderView(headerView);
var row = Ti.UI.createTableViewRow({
title : 'Press me long'
});
table.setData([row]);
_self.add(table);
table.addEventListener('click', function(e) {
Ti.API.info("#### table - row " + e.index + " clicked")
});
table.addEventListener('longpress', function(e) {
Ti.API.info("#### table - row " + e.index + " longpressed")
});
Tested and confirmed on Samsung Galaxy S2 Android 2.3.6 with latest 3.2 CI build. I will link the two issues.
Going to re-mark as a duplicate and reopened the old one.
Closing ticket as duplicate with reference to the above comments.