Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android view's post method

Tags:

android

view

I wanted to know if View.post(Runnable r) runnable's run() method is executed after View is drawn or after View (in case it is a ViewGroup) and all it's children are drawn?

like image 835
Heisenberg Avatar asked Sep 16 '26 15:09

Heisenberg


1 Answers

It will be put into UI message queue, and it depends on internal Android workings when exactly will be executed. If rendering of child views is in one message then it might execute after rendering, if it is split by android into several messages then your message might possibly be executed in between of rendering.

If you want to make sure it will be executed after child redraw, maybe use View.postDelayed with some small delay?


What event is fired after all views are fully drawn?

here is explanation from Romain Guy that it is actuall executed after redraw - if nothing changed (its 4 year old SO), then you might trust this answer.

like image 130
marcinj Avatar answered Sep 18 '26 03:09

marcinj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!