Reputation: 45
I'm trying to figure out how I can time how long button presses and stuff take in my android app. Are there tools in the android sdk that do this kind of thing for me? Or is there some sort of industry standard tool I can use to capture this data?
Upvotes: 1
Views: 80
Reputation: 616
The most common way to do this is just take the start time using System.nanoTime() when your code starts and then subtracting that from another call from System.nanoTime().
IE:
long dTime = System.nanoTime() - startTime;
as far as timing a button press use a onTouch listener and then get the start time in the on down event and the calculate the time using the on up event.
Upvotes: 1