title: Updating ExpandableListView items with AsyncTask
body: <p>I apologize for my English but translated with google. I need help for my application, I'm using a <code>ExpandableListView</code> with <strong>3 different</strong> groups, 2 groups with <strong>static</strong> items and a group with items that it should to <strong>update</strong> after a <code>AsyncTask</code>.
  When I run the application the first time, the group with dynamic items is <strong>empty</strong>, instead the second time is <strong>visible</strong>. How I do to update in real time dynamic items?
  My application is structured in this way, I have a main activity that instantiates the <code>ExpandableListView</code>, an other class that executes the <code>AsyncTask</code> and then I have a class that extends <code>BaseExpandableListAdapter</code>. I tried to use the method <code>notifyDataSetChanged()</code> in main activity, but it does not work.
  I hope I was clear enough and I hope that answers are equally clear, unfortunately I have been all over the internet but could not find the answer I was looking for. Thanks in advance to those who will help me.</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>public class MainActivity extends Activity {
  
  private ExpandableListView expListView;
  private ExpandableListAdapter listAdapter;
  List&lt;String&gt; listDataHeader;
  HashMap&lt;String, List&lt;String&gt;&gt; listDataChild;
  static ArrayList&lt;String&gt; allResults = new ArrayList&lt;String&gt;(5);
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          prepareListData();
  
          expListView = (ExpandableListView) findViewById(R.id.explist);
          listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
          expListView.setAdapter(listAdapter);
  
      }
  
      private void prepareListData() {
        GetResults getResults = new GetResults();
        getResults.execute();
        allResults = getResults.getAllResults();
  
        listDataHeader = new ArrayList&lt;String&gt;();
        listDataChild = new HashMap&lt;String, List&lt;String&gt;&gt;();
  
        /** header visualization */
        listDataHeader.add(getString(R.string.drawer_title_advanced));
        listDataHeader.add(getString(R.string.drawer_title_visualization));
        listDataHeader.add(getString(R.string.drawer_title_route));
  
        // Adding child data
        List&lt;String&gt; settings = new ArrayList&lt;String&gt;();
        List&lt;String&gt; visualization = new ArrayList&lt;String&gt;();
        List&lt;String&gt; routes = new ArrayList&lt;String&gt;();
  
        items1.add("Group 1");
        items2.add("Group 2");
  
        for (int i = 0; i &lt; allResults.size(); i++) {
            items3.add(allResults.get(i));
        }
  
        listDataChild.put(listDataHeader.get(0), items1);
        listDataChild.put(listDataHeader.get(1), items2);
        listDataChild.put(listDataHeader.get(2), items3);
      }
  }
  </code></pre>
  
  <p><strong>GetResults.java</strong></p>
  
  <pre><code>    public class GetResults extends AsyncTask&lt;String, Void, String&gt; {
  
      private static ArrayList&lt;String&gt; allResults = new ArrayList&lt;String&gt;(5);
  
          @Override
          protected String doInBackground(String... params) {
             //
          }
  
          @Override
          protected void onPostExecute(String res) {
                  JSONArray JsonArrayResult = new JSONArray(res);
                  for (int i = 0; i &lt; JsonArrayResult.length(); i++) {
                       JSONObject JsonObjectResult = JsonArrayResult.getJSONObject(i);
                       allResults.add(JsonObjectResult.getString("results"););
  
                  }
          }
  
          public ArrayList&lt;String&gt; getAllResults() {
             return allResults;
          }
     }
  </code></pre>
  
  <p><strong>ExpandableListAdapter.java</strong></p>
  
  <pre><code>    public class ExpandableListAdapter extends BaseExpandableListAdapter {
          private Context _context;
          private List&lt;String&gt; _listDataHeader; // header titles
          private HashMap&lt;String, List&lt;String&gt;&gt; _listDataChild;
          private LayoutInflater infalInflater;
  
       public ExpandableListAdapter(Context context,
                  List&lt;String&gt; listDataHeader,
                  HashMap&lt;String, List&lt;String&gt;&gt; listChildData) {
              this._context = context;
              this._listDataHeader = listDataHeader;
              this._listDataChild = listChildData;
          }
      @Override
      public int getGroupCount() {
          // TODO Auto-generated method stub
          return this._listDataHeader.size();
      }
  
      @Override
      public int getChildrenCount(int groupPosition) {
          // TODO Auto-generated method stub
          return this._listDataChild.get(this._listDataHeader.get(groupPosition))
                  .size();
      }
  
      @Override
      public Object getGroup(int groupPosition) {
          // TODO Auto-generated method stub
          return this._listDataHeader.get(groupPosition);
      }
  
      @Override
      public Object getChild(int groupPosition, int childPosition) {
          return this._listDataChild.get(this._listDataHeader.get(groupPosition))
                  .get(childPosition);
      }
  
      @Override
      public long getGroupId(int groupPosition) {
          // TODO Auto-generated method stub
          return 3;
      }
  
      @Override
      public long getChildId(int groupPosition, int childPosition) {
          // TODO Auto-generated method stub
          return childPosition;
      }
  
      @Override
      public boolean hasStableIds() {
          // TODO Auto-generated method stub
          return false;
      }
  
  @Override
  public View getGroupView(int groupPosition, boolean isExpanded,
          View convertView, ViewGroup parent) {
      String headerTitle = (String) getGroup(groupPosition);
      View v = null;
      if (convertView != null)
          v = convertView;
      else {
          // if (convertView == null) {
          LayoutInflater infalInflater = (LayoutInflater) this._context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          v = infalInflater.inflate(R.layout.list_group1, null);
      }
  
      TextView lblListHeader = (TextView) v.findViewById(R.id.lblListHeader);
      // lblListHeader.setTypeface(null, Typeface.BOLD);
      lblListHeader.setText(headerTitle);
  
      return v;
  }
  
      @Override
      public View getChildView(int groupPosition, int childPosition,
              boolean isLastChild, View convertView, ViewGroup parent) {
          View v = null;
          infalInflater = (LayoutInflater) this._context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          if (convertView == null) {
              if (groupPosition == 0) {
                  v = infalInflater.inflate(R.layout.adv_item, null);
              }
              if (groupPosition == 1) {
                  v = infalInflater.inflate(R.layout.visual_item, null);
              }
              if (groupPosition == 2) {
                  v = infalInflater.inflate(R.layout.routes_item, null);
              }
          } else {
              v = convertView;
          }
          return v;
      }
   }
  </code></pre>