I have activity, and I have a thread that starts when the operation starts. The thread calls one method called getTimeOfLastEvent,
public long getTimeOfLastEvent(){ return 0; }
I want this method to return, for example, milliseconds from the moment of the last event with this moment (the moment the method was called). with the word "event" I refer to any touch on the screen. For example, if a user touches the screen and then leaves the phone within 4 seconds, and at that moment getTimeOfLastEvent is called, I want this method to return 4 seconds to me (possibly in milliseconds units)
If I leave the phone after 10 seconds, the screen turns off, but if I touch the screen before 10 seconds, I reset the timer, and I get another 10 seconds ... my problem is that I do not know how to read this timer.
Lukap source share