Android Question Last Touch Time

Stulish

Active Member
Licensed User
Longtime User
Is there a method to get howmany ticks or seconds since the last touch of the screen??

The app i am creating needs to blank the screen after a user determined time, and then un-blank the screen on next touch, i wondered if there was something that already captured this that i could call and check the number of ticks/seconds.

Thanks

Stu
 

roumei

Active Member
Licensed User
I don't know an easy solution but you could try this:
- Create a sub in which you update a global variable 'LastTouchTime' with the current DateTime.
- Call this sub from the click or touch events of every view in your app. Make sure to add a panel for the background to catch taps outside the views.
- Add a timer and check the global variable 'LastTouchTime'. Show the blank screen panel if the difference to the current DateTime is bigger than your threshold.
- Hide the blank screen panel when the user touches it.
 
Upvote 0

Stulish

Active Member
Licensed User
Longtime User
I don't know an easy solution but you could try this:
- Create a sub in which you update a global variable 'LastTouchTime' with the current DateTime.
- Call this sub from the click or touch events of every view in your app. Make sure to add a panel for the background to catch taps outside the views.
- Add a timer and check the global variable 'LastTouchTime'. Show the blank screen panel if the difference to the current DateTime is bigger than your threshold.
- Hide the blank screen panel when the user touches it.
Thanks @roumei i was thinking of adding a panel and seing if touch events could pass through it but also register it, thatway i could have a transparent panel and reset the timer when it is touched, could even make it black when screen times out. Not sure if it is possible but thought i would ask first to see if there is an inbuild method.
 
Upvote 0
Top