Back to project page slider.
The source code is released under:
Apache License
If you think the Android project slider 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 de.devisnik.android.sliding; /*w w w . j av a 2s .c om*/ import java.util.concurrent.TimeUnit; import android.os.SystemClock; public class FPSCounter { private static final long UNIT = TimeUnit.SECONDS.toMillis(1); private long mIntervalStart = 0; private int mCounter; private String mFps = "unknown"; public void inc() { long uptimeMillis = SystemClock.uptimeMillis(); if (uptimeMillis > mIntervalStart + UNIT) { mFps = Integer.toString(mCounter); mCounter = 0; mIntervalStart = uptimeMillis; } mCounter += 1; } public String getFPS() { return mFps; } }