title: Expanding groups in ExpandableListView after updating the Adapter
body: <p>I have an <code>ExpandableListView</code> with an adapter that has the following data items:</p>
  
  <ul>
  <li>A (expanded)
  <ul>
  <li>Child</li>
  </ul></li>
  <li>B (expanded)
  <ul>
  <li>Child</li>
  </ul></li>
  <li>C (expanded)
  <ul>
  <li>Child</li>
  </ul></li>
  <li>D (collapsed)</li>
  </ul>
  
  <p>I have an async task that periodically verifies if there are any changes so I can update the adapter. However, I also would like to expand again these same groups that were expanded before (Group A and B). I decided to collapse all of the expanded groups and then open again those that were expanded before, because there may be some expanded groups that I need to collapse before removing so that its children don't stay in the list. In this way, if we have the list below (<em>), I want the groups A and B to be expanded and C to be collapsed before it is automatically removed using the notifyDataSetChanged(), because the notifityDataSetChanged doesn't remove the children from the removed groups. This is the result I would like to get from the listView:
  (</em>)
    - A (expanded)
       - Child
    - B (expanded)
       - Child
    - Y (collapsed)
    - Z (collapsed)</p>
  
  <p>However I get this result instead:</p>
  
  <ul>
  <li>A (expanded)
  <ul>
  <li>Child</li>
  </ul></li>
  <li>B (collapsed)</li>
  <li>Y (expanded)
  <ul>
  <li>Child</li>
  </ul></li>
  <li>Z (collapsed)</li>
  </ul>
  
  <p>This is the code that I used:</p>
  
  <pre><code> ArrayList&lt;String&gt; previousExpandedGroups = adapter.getExpandedGroups(listView);
   adapter.setGroups(processJSONData(result), listView);
   adapter.notifyDataSetChanged();
   adapter.expandGroups(listView, expandedGroups);
  </code></pre>
  
  <p>I figured out that this happens if I call <code>expandGroups()</code> after <code>notifyDataSetChanged()</code>. If I wait something like 50 milliseconds and execute the expandGroups again everything works properly. So, I've been searching but I cannot figure out if there is a function in the ExpandableListView API that can tell me if the ExpandableListView is ready for me to expand some of its groups. I've tried to override the <code>onFinishInflate()</code> from ExpandableListView, but this is only called on the first time the ExpandableListView is created. So, is there any function either from the adapter or the ExpandableListView that is fired up exactly when the ExpandableListView is ready for me to expand its groups after the notifyDataSetChanged has been executed on the adapter?</p>
  
  <p>Thank you.</p>