So how long do I have between calling setContent in an Activity or returning a view in onCreateView…
Scott Cooper
1

You are not limited with time. You are limited with task execution order.

Your onCreate method (or other lifecycle method in Activity or Fragment) is executed as a task in Looper queue. Right after your task, there’s already a next one, which is a layout of the view hierarchy.

So basically if your code is synchronous, layout task will not be executed before you finish your stuff.

But if your code is asynchronous, it doesn’t matter how fast it is, even if it’s a fraction of a millisecond, you will have to post result into the Looper queue and this result will appear after layout task ended, which is already too late.