Cursor getShort - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Cursor getShort method.

This code example shows how to use the following methods:getBlob, getDouble, getFloat, getInt, getLong
 
    /** @inheritdoc */ 
    @Override 
    public SimpleEntity readEntity(Cursor cursor, int offset) {
        SimpleEntity entity = new SimpleEntity( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getShort(offset + 1) != 0, // simpleBoolean
            cursor.isNull(offset + 2) ? null : (byte) cursor.getShort(offset + 2), // simpleByte
            cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3), // simpleShort
            cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4), // simpleInt
            cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5), // simpleLong
            cursor.isNull(offset + 6) ? null : cursor.getFloat(offset + 6), // simpleFloat
            cursor.isNull(offset + 7) ? null : cursor.getDouble(offset + 7), // simpleDouble
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // simpleString
            cursor.isNull(offset + 9) ? null : cursor.getBlob(offset + 9) // simpleByteArray
        ); 
        return entity;
    } 
      
    /** @inheritdoc */ 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getShort
    wrappedCursor.copyStringToBuffer(i, charArrayBuffer);
  } 
 
  @Implementation 
  public short getShort(int i) {
    return wrappedCursor.getShort(i);
  } 
 
  @Implementation 
  public int getInt(int i) {
    return wrappedCursor.getInt(i);
  } 
 
  @Implementation 
  public long getLong(int i) {
    return wrappedCursor.getLong(i);
  } 
 
  @Implementation 
  public float getFloat(int i) {
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getColumnIndex, getShort
    } 
 
    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);
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getShort
    } 
 
    @Override 
    public short getShort(int column)
    { 
        return mCursor.getShort(column);
    } 
 
    @Override 
    public int getInt(int column)
    { 
        return mCursor.getInt(column);
    } 
 
    @Override 
    public long getLong(int column)
    { 
        return mCursor.getLong(column);
    } 
 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getShort
    } 
 
    @Override 
    public short getShort(int column)
    { 
        return mCursor.getShort(column);
    } 
 
    @Override 
    public int getInt(int column)
    { 
        return mCursor.getInt(column);
    } 
 
    @Override 
    public long getLong(int column)
    { 
        return mCursor.getLong(column);
    } 
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getShort
        wrappedCursor.copyStringToBuffer(i, charArrayBuffer);
    } 
 
    @Implementation 
    public short getShort(int i) {
        return wrappedCursor.getShort(i);
    } 
 
    @Implementation 
    public int getInt(int i) {
        return wrappedCursor.getInt(i);
    } 
 
    @Implementation 
    public long getLong(int i) {
        return wrappedCursor.getLong(i);
    } 
 
    @Implementation 
    public float getFloat(int i) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getShort
        return mPosition;
    } 
 
    @Override 
    public short getShort(int columnIndex) {
        return mActiveCursor.getShort(columnIndex);
    } 
 
    @Override 
    public String getString(int columnIndex) {
        return mActiveCursor.getString(columnIndex);
    } 
 
    @TargetApi(11) 
    @Override 
    public int getType(int columnIndex) {
        return mActiveCursor.getType(columnIndex);
    } 
 
    @Override 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getShort, isNull
	public String getString(int columnIndex) {
		return cursor.getString(columnIndex);
	} 
 
	public boolean getBoolean(int columnIndex) {
		if (cursor.isNull(columnIndex) || cursor.getShort(columnIndex) == 0) {
			return false; 
		} else { 
			return true; 
		} 
	} 
 
	public char getChar(int columnIndex) throws SQLException {
		String string = cursor.getString(columnIndex);
		if (string == null || string.length() == 0) {
			return 0; 
		} else if (string.length() == 1) {
			return string.charAt(0);
		} else { 
			throw new SQLException("More than 1 character stored in database column: " + columnIndex);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getColumnIndex, getShort
    } 
 
    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);
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getColumnCount, getShort
        return mCursor.getString(column);
    } 
 
    @Override 
    public short getShort(int column) {
        if (column == mCursor.getColumnCount()) {
            return (Short) mValue;
        } 
        return mCursor.getShort(column);
    } 
 
    @Override 
    public int getInt(int column) {
        if (column == mCursor.getColumnCount()) {
            return (Integer) mValue;
        } 
        return mCursor.getInt(column);
    } 
 
    @Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
getShort Method Overview
Returns the value of the requested column as a short.
See Code Examples for other Android Cursor Methods: