Skip to content

Most visited

Recently visited

navigation
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.

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
void doFrame (long frameTimeNanos)

Called when a new display frame is being rendered.

This method provides the time in nanoseconds when the frame started being rendered. The frame time provides a stable time base for synchronizing animations and drawing. It should be used instead of uptimeMillis() or nanoTime() for animations and drawing in the UI. Using the frame time helps to reduce inter-frame jitter because the frame time is fixed at the time the frame was scheduled to start, regardless of when the animations or drawing callback actually runs. All callbacks that run as part of rendering a frame will observe the same frame time so using the frame time also helps to synchronize effects that are performed by different callbacks.

Please note that the framework already takes care to process animations and drawing using the frame time as a stable time base. Most applications should not need to use the frame time information directly.

Parameters
frameTimeNanos long: The time in nanoseconds when the frame started being rendered, in the nanoTime() timebase. Divide this value by 1000000 to convert it to the uptimeMillis() time base.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)