In your main Activity
class, override the onDraw()
method. Call super.onDraw()
, then save the current system time. Compute delta_time
in ms between the current draw call and the previous draw call. Then calculate FPS with 1000 ms / delta_time ~ FPS
Here are a few pseudo codes:
void onDraw(){ super.onDraw() curTime = getTime(); deltaTime = curTime - prevTime(); aproxFps = 1000 / deltaTime; prevTime = curTime; }
source share