Hm, looks like ViewTreeObserver
might help you there. Try this code:
final ViewTreeObserver vto = myView.getViewTreeObserver();
vto.addOnDrawListener(new ViewTreeObserver.OnDrawListener() {
@Override
public void onDraw() {
// Do whatever you need to do...
}
});
Couple of notes:
onDraw
has bunch of limitations of what you can do in it. Specifically, you can't modify the view tree. If that's something you need to do, look at theViewTreeObserver.OnPreDrawListener
instead.- camera preview and media playback are drawn on a separate path, and most likely are not synchronized with this listener, so you wan't be able to use it to do stuff in sync with the individual frames.