Slide 13
Slide 13 text
class Metronome implements Choreographer.FrameCallback {
private Choreographer choreographer;
public Metronome() {
choreographer = Choreographer.getInstance();
}
public void start() {
choreographer.postFrameCallback(this);
}
public void stop() {
choreographer.removeFrameCallback(this);
}
@Override public void doFrame(long frameTimeNanos) {
Timber.i(“Callback frameTimeNanos” + frameTimeNanos);
choreographer.postFrameCallback(this);
}
}