private void runAfterImageDraw ( final Runnable action ) { image . getViewTreeObserver ( ) . addOnPreDrawListener ( new OnPreDrawListener ( ) { @ Override public boolean onPreDraw ( ) { image . getViewTreeObserver ( ) . removeOnPreDrawListener ( this ) ; runOnNextFrame ( action ) ; return true ; } } ) ; image . invalidate ( ) ; }
Runs provided action after image is drawn for the first time .