Reputation: 307
I want to calculate time after a button pressed ,so that i can keep track that this much has been passed.I have search it and find that android timer can do that but i couldn't get any useful answer for that.
Thanks in advance.
Upvotes: 0
Views: 3701
Reputation: 533
On start button press:
long start = System.currentTimeMillis();
On update/end button press:
long runTime = System.currentTimeMillis() - start;
Upvotes: 2
Reputation: 1404
if you only want to calculate time difference between two events then you can use
System.currentTimeMillis();
.
Upvotes: 0