title: Expandable ListView get group child count - onClick
body: <p>I am using an expandable listview in Navigation Drawer. Now the items in this list are fetched from a webservice - along with the children. </p>
  
  <p>Based on the login type some users only see part of the Navigation drawer. So I have some items with 0 children and I need to detect this condition so that I can redirect on header click to a different page. </p>
  
  <p>Here is my scenario: </p>
  
  <p>I want to get the number of children in a group when the header is clicked. Is this even possible? </p>
  
  <p>So far I have tried this, but the result are not proper: </p>
  
  <pre><code> @Override
      public void onDrawerHeaderSelected(ExpandableListView parent, View v, int groupPosition, long id) {
  
          switch (groupPosition) {
              case 1:
                  if (parent.getChildCount() == 0)
                      displayFragment(groupPosition);
                  break;
              case 2:
                  if (parent.getChildCount() == 0)
                      displayFragment(groupPosition);
                  break;
              default:
                  displayFragment(groupPosition);
          }
  
  
      }
  </code></pre>
  
  <p><code>parent.getChildCount()</code> seems to give me a total nmber of visible children. </p>