Hello. I have this code which works fine on iOS, but not on android. What I’m trying to accomplish is a dialog pop-up if you hold your finger down on a scrollView for longer than a second. But cancel it if the finger releases or moves before that amount of time.
local PushedtimerID function displayScrollListener( event ) local phase = event.phase if ( "began" == phase ) then print( event.target.id .. " pressed" ) myGlobals.touchedY = event.y PushedtimerID = timer.performWithDelay( 1500, bookMarkCreator) elseif ( "ended" == phase ) then print( event.target.id .. " released" ) timer.cancel(PushedtimerID) elseif "moved" == phase then local dy = math.abs( ( event.y - event.yStart ) ) if dy \> 10 then timer.cancel(PushedtimerID) end end return true end
on Android the timer.cancel never cancels the timer, every touch brings up the alert in my bookMarkCreator()
How can I get Android to cancel the timer like iOS does?