Coordinates the timing of animations, input and drawing.
The choreographer receives timing pulses (such as vertical synchronization) from the display subsystem then schedules work to occur as part of rendering the next display frame.
Applications typically interact with the choreographer indirectly using higher level abstractions in the animation framework or the view hierarchy. Here are some examples of things you can do using the higher-level APIs.
- To post an animation to be processed on a regular time basis synchronized with
display frame rendering, use
- To post a
Runnableto be invoked once at the beginning of the next display frame, use
- To post a
Runnableto be invoked once at the beginning of the next display frame after a delay, use
- To post a call to
invalidate()to occur once at the beginning of the next display frame, use
postInvalidateOnAnimation(int, int, int, int).
- To ensure that the contents of a
Viewscroll smoothly and are drawn in sync with display frame rendering, do nothing. This already happens automatically.
onDraw(Canvas)will be called at the appropriate time.
However, there are a few cases where you might want to use the functions of the choreographer directly in your application. Here are some examples.
- If your application does its rendering in a different thread, possibly using GL,
or does not use the animation framework or view hierarchy at all
and you want to ensure that it is appropriately synchronized with the display, then use
- ... and that's about it.