Added in API level 16

FrameCallback


interface 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 Unit
doFrame(frameTimeNanos: Long)

Called when a new display frame is being rendered.

Public methods

doFrame

Added in API level 16
abstract fun doFrame(frameTimeNanos: Long): Unit

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 android.view.Choreographer.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 android.view.Choreographer.FrameData#getAnimationTimeNanos().