I am working at an Android
app in Titanium
. My question is how to implement long touch in Titanium? I need something like this: when user keep pressed a certain view to call some function. I tried this :
arrowright.addEventListener('touchstart', function(e) {
touched = true;
setTimeout(function() {
if (touched) {
arrowright.fireEvent('longTouch');
}
},100);
});
arrowright.addEventListener('touchmove', function(e) {
touched = false;
});
arrowright.addEventListener('touchend', function(e) {
touched = false;
});
arrowright.addEventListener('longTouch',function(){
clickTheView(e);
},
false);
but this is not working like I want. My function clickTheView(e) is call every time I click the view and it is not called when I touch for a long time the view.
Any idea is welcome. Thanks in advance.