Code example for Cursor

Methods: deactivategetCountgetStringmoveToFirstmoveToNextrequery

0
        }; 
        Cursor c = mDatabase.rawQueryWithFactory(
                factory, "SELECT data FROM test WHERE _id <= ?", new String[]{"1"},
                null); 
        assertNotNull(c);
        assertEquals(1, c.getCount());
        assertTrue(c.moveToFirst());
        assertEquals(sString1, c.getString(0));
 
        // Our hacked requery() changes the query arguments in the cursor. 
        c.requery();
 
        assertEquals(2, c.getCount());
        assertTrue(c.moveToFirst());
        assertEquals(sString1, c.getString(0));
        assertTrue(c.moveToNext());
        assertEquals(sString2, c.getString(0));
 
        // Test that setting query args on a deactivated cursor also works. 
        c.deactivate();
        c.requery();
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java