Android Button - Long Press

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

Android Button - Long Press

Post by Googie85 » Thu Aug 31, 2017 7:27 am

Hi Guys!

I am trying to get some code to work where a person holds a button in for 3 seconds on an Android device.

Any ideas would be welcomed greatly!

Googie.

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Android Button - Long Press

Post by Klaus » Thu Aug 31, 2017 10:18 am

Hi Googie,

out of my head:

Code: Select all

local tPressDuration

on mousedown
  put the millisecs into tPressDuration
end mousedown

on mouseup
  if the millisecs - tPressDuration >= 3000 then
      ### do your 3 seconds stuff
   else
     ## "normal" mouseup stuff here, if any
  end if
end mouseup
Or maybe use "touchstart" and "touchend", you get the picture...

Best

Klaus

Post Reply

Return to “Android Deployment”