I have an activity and I have a thread that runs when the activity is started. The thread call one method called getTimeOfLastEvent,
public long getTimeOfLastEvent(){
return 0;
}
I want this method to return me for example milliseconds from the time when the last event happened to this moment(the moment when the method is called). with the word 'event' I refer to any touch on the screen. And for example if the user touches the screen and then leave the phone for a 4 seconds and in that moment the getTimeOfLastEvent is called I want this method to return me 4 seconds (probably in unit milliseconds)
If I leave the phone after 10 seconds the screen is turned off, but if I touch the screen just before the 10 seconds pass, the timer i reset and I got another 10 seconds..., my problem is that I do not know how to read this timer.