Expand/collapse group nodes in ExpandableListView based on passed Cursor values?
<p>I've got a ExpandableListView widget that is populated using an adapter based on the SimpleCursorTreeAdapter as shown below. I I query my SQL database for the ListView's group titles as well as a boolean value to whether the group should be expanded or collapsed (which is returned in a Cursor). I then feed this Cursor to my adapter and the list is populated and displayed.</p>

<p>The only thing I can't do, is have the group nodes in the ListView be expanded or collapsed based on the boolean value in the supplied Cursor. I want to have this happen when the activity containing this ExpandableListView widget is initally created, loaded, and displayed.</p>

<p>Is there a way to have my adapter take the boolean values supplied in the Cursor object and use them to expand or collapse these group nodes?</p>

<pre><code>public class MyExpandableListAdapter extends SimpleCursorTreeAdapter
    {
        public MyExpandableListAdapter (Cursor cursor, Context context, int groupLayout, 
                                        int childLayout,
                                String[] groupFrom, int[] groupTo,
                                       String[]childrenFrom,int[]childrenTo)
        {               
           super(context,cursor,groupLayout,groupFrom,groupTo,childLayout,childrenFrom,childrenTo);
        }

    @Override
    protected Cursor getChildrenCursor(Cursor groupCursor) 
    {
        String strCategory = 
                   groupCursor.getString(groupCursor.getColumnIndex("strCategory")); 

        Cursor cur = mainActivity.mDbHelper.getCardTitlesForCategory(strCategory);

        return cur;
    }
}
</code></pre>

<p>Thanks for your suggestions and advice.</p>
