Problem
TableView does not respond to touch events (touchstart, touchmove, touchend, touchcancel). This is a regression, as this worked fine in 1.7.5 and the 1.8.0.v... continuous build from September. This also works fine in iOS. Only Android is affected.
Test Case
drop the following app.js code into a new project
build with SDK 1.8.1
run on the Android 2.2 emulator
press and hold any row. *No touchstart event occurs.*
while still holding the row, move the mouse around a little. *No touchmove event occurs.*
let go of the row. *No touchend event occurs.*
var win1=Ti.UI.createWindow({
backgroundColor:'#fff',
exitOnClose:true,
layout:'vertical',
navBarHidden:false,
backgroundColor:'black'
});
var TopLabel=Ti.UI.createLabel({text:'Last row will only be half visible when scrolled',
color:'black',
left:0,
right:0,
height:25,
backgroundColor:'yellow'});
win1.add(TopLabel);
var MyListbox=Ti.UI.createTableView({backgroundColor:'black'});
for (var i=1; (i <= 10); i++)
MyListbox.appendRow(Ti.UI.createTableViewRow({title:'Row '+i}));
Ti.API.info('adding EventListener for touchstart');
MyListbox.addEventListener('touchstart',TchStart);
function TchStart(evt)
{
Ti.API.info('TchStart');
}
Ti.API.info('adding EventListener for touchmove');
MyListbox.addEventListener('touchmove',TchMove);
function TchMove(evt)
{
Ti.API.info('TchMove');
}
Ti.API.info('adding EventListener for touchend');
MyListbox.addEventListener('touchend',TchEnd);
function TchEnd(evt)
{
Ti.API.info('TchEnd');
}
Ti.API.info('adding EventListener for touchcancel');
MyListbox.addEventListener('touchcancel',TchCancel);
function TchCancel(evt)
{
Ti.API.info('TchCancel');
}
Ti.API.info('adding EventListener for click');
MyListbox.addEventListener('click',LBClick);
function LBClick(evt)
{
Ti.API.info('LBClick');
}
win1.add(MyListbox);
win1.open();
With SDK 2.0.0.v20120325213306, same results. However, if you add a 'longclick' listener, then when you hold down a row you get a full screen of this error repeating:
in the console. And 'longclick' fires whether you continue holding down the row or just hold it down for a little longer than normal. This doesn't really give a good way to handle what is really a 'longpress' (but 'longpress' doesn't fire for Android.
I can confirm that this bug exists and needs to be addressed asap. Tested on a HTC Sensation running Android 2.3.x. I wasn't able to get the issue with the 'long press' in the latest CI build, however I could reproduce all the issues in the original description.
To be clear, I mean I'm unable to reproduce the 'full screen error' that Shawn is getting. However I'm able to confirm that I don't see any longpress events get fired at all.
HD ticket: http://support.appcelerator.com/tickets/APP-293867
Submitted [PR #1990](https://github.com/appcelerator/titanium_mobile/pull/1990) to resolve issue.
Verified fixed in SDK 2.1.0.v20120416160358. Thanks!
Verified touchstart, move, end and cancel work as expected with SDK 2.1.0.v20120618154152.