Code example for Adapter

Methods: registerDataSetObserver

0
        int pos = this.headers.getCount();
        this.headers.add(section);
        if (background != null) {
            this.sectionBackgrounds.put(pos, background);
        } 
        this.sections.put(section, adapter);
         
        //if any section adapters have changed, bubble that notification up to the view, to repopulate the list 
        adapter.registerDataSetObserver(new DataSetObserver() {
            @Override 
            public void onChanged() { 
                notifyDataSetChanged();
            } 
        }); 
    }   
 
    public void clear() { 
        this.headers.clear();
        this.sectionBackgrounds.clear();
        this.sections.clear();
    }