good time to manually layout an activity's view?
<p>I have this activity where in I need to do some layout at runtime (in this particular instance I need to set the indicator bounds (<code>ExpandableListView.setIndicatorBound</code>) so that the group indicator aligns to the right side of the view instead of the default left.</p>

<p>I've got this code in my <code>Activity:onCreate</code>:</p>

<pre><code>int viewWidth = mListView.getWidth();
int groupIndicatorWidth = getResources().getDrawable(R.drawable.up).getMinimumWidth(); 
mListView.setIndicatorBounds(viewWidth - groupIndicatorWidth, viewWidth);
app.fetchItems(this);
</code></pre>

<p>Quite understandably, <code>viewWidth</code> turns out to be <code>0</code> at runtime.</p>

<p>My question is what method should I implement/overload when the view's children would have been laid out and their dimensions valid? Basically on Windows we would generally put such code in OnSize/OnResize. </p>

<p>I found <code>Activity:onPostCreate</code> and <code>Activity:onPostResume</code>, but I also found this in the docs - "Applications will generally not implement this method; it is intended for system classes to do final initialization after application code has run."</p>

<p><strong>Edit</strong></p>

<p>Found this thread which has several workarounds listed:
<a href="http://stackoverflow.com/questions/4888624/android-need-to-use-onsizechanged-for-view-getwidth-height-in-class-extending">Android: Need to use onSizeChanged for View.getWidth/Height() in class extending Activity</a></p>
