Possible Duplicate:
When has the Activity finished drawing itself?
I want to know when a view completes its drawing, is that possible? How can I understand if android finished drawing a view or not?
Add a ViewTreeObserver to it.
Sample,
TextView pagerView1=new TextView(this);
ViewTreeObserver textViewTreeObserver=pagerView1.getViewTreeObserver();
textViewTreeObserver.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
public void onGlobalLayout() {
//Do your operations here.
pagerView1.removeGlobalOnLayoutListener(this);
}
});
This is a Listener which gets called once that particular gets drawn completely. So I have made it use for TextView. Similarly you can make use of any view you do. And inside onGlobalLayout() you can do your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With