Added in API level 16

Choreographer.FrameCallback


public static interface Choreographer.FrameCallback

android.view.Choreographer.FrameCallback


Implement this interface to receive a callback when a new display frame is being rendered. The callback is invoked on the Looper thread to which the Choreographer is attached.

If you require timing information, e.g. for animations, use VsyncCallback instead.

Summary

Public methods

abstract void doFrame(long frameTimeNanos)

Called when a new display frame is being rendered.

Public methods

doFrame

Added in API level 16
public abstract void doFrame (long frameTimeNanos)

Called when a new display frame is being rendered.

This method provides an adjusted timestamp in nanoseconds when the frame started being rendered. In the past it was recommended to use this timestamp for animations. However, using this timestamp for animations, causes animations to skip forward after late frames, which introduces undesired jank. Instead, use ERROR(FrameData.getAnimationTimeNanos()/android.view.Choreographer.FrameData#getAnimationTimeNanos() FrameData.getAnimationTimeNanos()) from the VsyncCallback for smoother animations. Only use this timestamps for frame timing information (e.g. comparing to current time, frame deadlines, etc.).

Parameters
frameTimeNanos long: The time in nanoseconds when the frame started being rendered. Deprecated for use in animations in favor of ERROR(FrameData.getAnimationTimeNanos()/android.view.Choreographer.FrameData#getAnimationTimeNanos() FrameData.getAnimationTimeNanos()).