views:

59

answers:

0

Using com.example.android.notepad and ExpandableList2.java from com.example.android.apis.view, I have written a simple application that contains a content provider serving two tables in an sqlite database and a display activity that uses my ExpandableListActivity subclass. I am using my own layouts for the ExpandableList, and the group and child layouts. The contents of the database are being displayed properly in the display activity, and the groups collapse and expand fine. However, if I expand a group, and click on a child to select it, I get the following stack dump:

Thread [<3> main] (Suspended (exception IllegalStateException))
CursorWindow.getLong(int, int) line: 331
SQLiteCursor(AbstractWindowedCursor).getLong(int) line: 108
ContentResolver$CursorWrapperInner(CursorWrapper).getLong(int) line: 127
CursorTreeAdapter$MyCursorHelper.getId(int) line: 435
SongsList $SetListExpandableListAdapter(CursorTreeAdapter).getChildId(int, int) line: 172
ExpandableListConnector.getItemId(int) line: 428
AbsListView$PerformClick.run() line: 1635
ViewRoot(Handler).handleCallback(Message) line: 587
ViewRoot(Handler).dispatchMessage(Message) line: 92
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4203
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 791
ZygoteInit.main(String[]) line: 549
NativeStart.main(String[]) line: not available [native method]

My SimpleCursorTreeAdapter:

public class SetListExpandableListAdapter extends
SimpleCursorTreeAdapter {

    public SetListExpandableListAdapter(Context context, Cursor cursor, 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 setListCursor) {
        Uri.Builder builder =
            SetListDefs.Songs.CONTENT_URI.buildUpon();
        Uri songsUri = builder.build();
        return managedQuery(songsUri, mSongProjection,
            "SETLIST = '" +  
             Long.toString(setListCursor.getLong(mSetListIdColumnIndex)) + "'",
             null, null);
    }
}

I've yet to be able to set a breakpoint in my code that is reached before the IllegalStateException gets thrown. Looks to me that I'm doing what the examples do, but apparently there is something I'm missing.

Some help would be greatly appreciated.