Code example for Cursor

Methods: getColumnIndexgetShort

0
    } 
 
    private void checkCursorExtraRowShort(short value) {
        String column = "extra_short";
        Cursor c = createCursorWithExtras(column, value);
        assertEquals("Extra column value", value, c.getShort(c.getColumnIndex(column)));
    } 
 
    private Cursor createCursorWithExtras(String columnName, Object columnValue) {
        MockSuggestionProviderCursor expectedCursor = new MockSuggestionProviderCursor(
                new String[]{"_id",   SearchManager.SUGGEST_COLUMN_TEXT_1, columnName });
        expectedCursor.addRow(       0,       "Text 1",                            columnValue);
 
        // this roughly approcimates what happens to suggestions 
        CursorBackedSourceResult suggestions = new CursorBackedSourceResult(
                MockSource.SOURCE_1, "", expectedCursor);
        assertEquals("Number of suggestions", 1, suggestions.getCount());
        suggestions.moveTo(0);
        SuggestionCursorBackedCursor observedCursor = new SuggestionCursorBackedCursor(suggestions);
 
Contextual code suggestions in your IDE  Get Codota for Java