My solution:
list = (ListView) findViewById(R.id.list);
list.getViewTreeObserver().addOnPreDrawListener(mOnPreDrawListener);
...
private final ViewTreeObserver.OnPreDrawListener mOnPreDrawListener = new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
mMessageList.getViewTreeObserver().removeOnPreDrawListener(this);
// Do what you want to do on data loading here
return true;
}
};