Overview:
- I have an Expandable List View which displays items of the type ToDoElement.
- Each ToDoElementitem has one String for the Group-Element and 1-3 Strings for the Child-Elements
- My custom List Adapter expListAdaptergets the informations about the group- and child-items with the methodscreateGroupList()andcreateChildList().
- In the Method createChildList()i check how many Strings for the child-items are in theToDoElementand create the child-items for the Adapter.
- At the end I can sort my list by comparing the Strings for the group-items.
All of this works fine, but here is my Problem:
- After the items in the List View are sorted correctly, the number of child-items is wrong.
- That's because my List Adapter doesn't know that the number of child-items has changed. So some child-items aren't displayed and other child-items are just empty, because there is no data for them.
My Suggestion:
I know that somehow the methods createGroupList() and createChildList() have to be called again from my Adapter, but i don't know how to do it. 
I've tried expListAdapter.notifyDataSetInvalidated(), because somebody told me that this method would call createGroupList() and createChildList() again, but is doesn't work.
Code Fragments:
Definition of my List Adapter:
expListAdapter = new MyListAdapter(this, createGroupList(), createGroupList());
setListAdapter( expListAdapter );
createGroupList() and createChildList():
    private List createGroupList() {    
      ArrayList result = new ArrayList();
      for (int i=0; i < Liste.AnzahlElemente(); i++) {    //
        result.add(Liste.getSize(i).getGroupString());
      }
      return result;
    }
    private List createChildList() {
        ArrayList result = new ArrayList();
        for(int i=0; i < Liste.getSize(); i++) {
            ArrayList secList = new ArrayList();
            for( int n = 1 ; n <= 3 ; n++ ) {
                if (Liste.getElement(i).getChildString(n).length() != 0){
                    secList.add( "- " + Liste.getElement(i).getChildString(n));
                }
            }
            result.add( secList );
        }
        return result;
}
Sorting the List:
(Liste is an ToDoListe object, which manages the ToDoElements in an Array List)
Collections.sort(Liste.getListe(), new NameComparator());
expListAdapter.notifyDataSetInvalidated();
//expListAdapter.notifyDataSetChanged(); //same effect as notifyDataSetInvalided
my NameComparator:
public class NameComparator implements Comparator<ToDoElement>{
     public int compare(ToDoElement item1, ToDoElement item2) {
           return item1.getGroupString().compareTo(item2.getGroupString());
     }
}
Thanks a lot for your help!!
 
     
    