Search code examples
javaandroidondrawinvalidation

Is it possible to execute onDraw() right after invalidate(Rect)?


I added a breakpoint in my onDraw() method and noticed that my debugger only gets there after the method in which invalidate(rect) is, ends. Is it possible to be called right after? Because I need to call invalidate(rect) twice in my method.

Thanks in advance.


Solution

  • No. Calling invalidate() is a signal to the framework that a portion of the screen is dirty and needs to be redrawn. The actual drawing doesn't happen immediately... it happens the next time through the main thread's event queue.