How to manage cursor in SimpleCursorTreeAdapter when getChildrenCursor uses rawQuery

244 Views Asked by At

I have some legacy code that uses rawQuery to create Cursors. The raw query strings are complicated and very long. I'm using these raw queries in the getChildrenCursor() of a SimpleCursorTreeAdapter. The docs say I have to manage my cursors, so what's the best way to do that if I can't use content providers which means no calls to managedQuery or CursorLoader.

Example:

protected Cursor getChildrenCursor(Cursor arg0) 
{
    Cursor cursor = null;   
    //How to manage this cursor?
    cursor = getDatabase().rawQuery(legacyQueryString, null);       
    return cursor;          
}
0

There are 0 best solutions below