Back to project page AndroidLapTimer.
The source code is released under:
MIT License
If you think the Android project AndroidLapTimer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.pimentoso.android.laptimer; //from w ww. j a va 2 s . c o m import android.util.Log; public class FPSCounter { private int frames = 0; private int fps = 0; private long startTime = System.nanoTime(); private StringBuilder sb = new StringBuilder(); public void update() { frames++; if(System.nanoTime() - startTime >= 1000000000) { fps = frames; frames = 0; startTime = System.nanoTime(); Log.d("Mini4WD Lap Timer FPS", printFrames()); } } public String printFrames() { sb.setLength(0); sb.append("fps: ").append(fps); return sb.toString(); } }