Android on screen redraw notifications

388 views Asked by At

Is there anyway in android to attach a listener to listen for anytime any element on the screen is redrawn? I know it's possible on iOS but haven't found an equivalent in android

1

There are 1 answers

0
rnrneverdies On

You are looking for ViewTreeObserver

A view tree observer is used to register listeners that can be notified of global changes in the view tree. Such global events include, but are not limited to, layout of the whole tree, beginning of the drawing pass, touch mode change...

public void addOnDrawListener (ViewTreeObserver.OnDrawListener listener)

Register a callback to be invoked when the view tree is about to be drawn.