Cursor getInt - 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 getInt method.

This code example shows how to use the following methods:getInt, getString
        mContactAccessor = ContactAccessor.getInstance();
    } 
 
    @Override 
    public final CharSequence convertToString(Cursor cursor) {
        String name = cursor.getString(RecipientsAdapter.NAME_INDEX);
        int type = cursor.getInt(RecipientsAdapter.TYPE_INDEX);
        String number = cursor.getString(RecipientsAdapter.NUMBER_INDEX).trim();
 
        String label = cursor.getString(RecipientsAdapter.LABEL_INDEX);
        CharSequence displayLabel = mContactAccessor.phoneTypeToString(mContext, type, label);
 
        if (number.length() == 0) {
            return number;
        } 
 
        if (name == null) {
            name = "";
        } else { 
            // Names with commas are the bane of the recipient editor's existence. 

9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close, getColumnIndexOrThrow, getInt, moveToFirst
      cursor = database.query(TABLE_NAME, new String[] {VERIFIED},
                              NUMBER + " = ? AND " + ZID + " = ?",
                              new String[] {encodedNumber, encodedZid},
                              null, null, null); 
 
      if (cursor != null && cursor.moveToFirst()) {
        return cursor.getInt(cursor.getColumnIndexOrThrow(VERIFIED)) == 1;
      } 
 
      return false; 
    } finally { 
      if (cursor != null)
        cursor.close();
    } 
  } 
 
  public void setRetainedSecret(String number, byte[] zid, byte[] rs1, long expiration, boolean continuity) {
    if (System.currentTimeMillis() >= expiration)
      return; 
 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getInt, getLong, getString, isNull
 
    /** @inheritdoc */ 
    @Override 
    public SpecialNamesEntity readEntity(Cursor cursor, int offset) {
        SpecialNamesEntity entity = new SpecialNamesEntity( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // count
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // select
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // sum
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // avg
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // join
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // distinct
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // on
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // index
            cursor.isNull(offset + 9) ? null : cursor.getInt(offset + 9) // order
        ); 
        return entity;
    } 
      
    /** @inheritdoc */ 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnIndex, getInt
		return bookmark;
	} 
		 
	private void readScreenSettings(BookmarkBase bookmark, Cursor cursor) {
		BookmarkBase.ScreenSettings screenSettings = bookmark.getScreenSettings();
		screenSettings.setColors(cursor.getInt(cursor.getColumnIndex("screenColors")));
		screenSettings.setResolution(cursor.getInt(cursor.getColumnIndex("screenResolution")));
		screenSettings.setWidth(cursor.getInt(cursor.getColumnIndex("screenWidth")));
		screenSettings.setHeight(cursor.getInt(cursor.getColumnIndex("screenHeight")));		
	} 
	 
	private void readPerformanceFlags(BookmarkBase bookmark, Cursor cursor) {
		BookmarkBase.PerformanceFlags perfFlags = bookmark.getPerformanceFlags();
		perfFlags.setRemoteFX(cursor.getInt(cursor.getColumnIndex("performanceRemoteFX")) == 0 ? false : true);
		perfFlags.setWallpaper(cursor.getInt(cursor.getColumnIndex("performanceWallpaper")) == 0 ? false : true);
		perfFlags.setTheming(cursor.getInt(cursor.getColumnIndex("performanceTheming")) == 0 ? false : true);
		perfFlags.setFullWindowDrag(cursor.getInt(cursor.getColumnIndex("performanceFullWindowDrag")) == 0 ? false : true);
		perfFlags.setMenuAnimations(cursor.getInt(cursor.getColumnIndex("performanceMenuAnimations")) == 0 ? false : true);
		perfFlags.setFontSmoothing(cursor.getInt(cursor.getColumnIndex("performanceFontSmoothing")) == 0 ? false : true);
		perfFlags.setDesktopComposition(cursor.getInt(cursor.getColumnIndex("performanceDesktopComposition")) == 0 ? false : true);
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close, getInt, moveToNext
				"select exists(select _id from Events)" 
				; 
 
			c = db.rawQuery(sql, null);
 
			if(c.moveToNext()) {
				result = c.getInt(0) != 0;
			} 
		} catch (SQLException e) {
			Log.e(TAG, "Error determining if there are events to send: ", e);
		} finally { 
			if (c != null) {
				c.close();
			} 
			if (db != null) {
				db.close();
			} 
		} 
 
		return result;
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getColumnIndex, getInt, getLong, getString, isNull
        final boolean validIcon = mResPackage != null && mIconRes != -1;
        return validIcon ? pm.getDrawable(mResPackage, mIconRes, null) : null;
    } 
 
    private static String getString(Cursor cursor, String columnName) {
        return cursor.getString(cursor.getColumnIndex(columnName));
    } 
 
    private static int getInt(Cursor cursor, String columnName) {
        return cursor.getInt(cursor.getColumnIndex(columnName));
    } 
 
    private static int getInt(Cursor cursor, String columnName, int missingValue) {
        final int columnIndex = cursor.getColumnIndex(columnName);
        return cursor.isNull(columnIndex) ? missingValue : cursor.getInt(columnIndex);
    } 
 
    private static long getLong(Cursor cursor, String columnName, long missingValue) {
        final int columnIndex = cursor.getColumnIndex(columnName);
        return cursor.isNull(columnIndex) ? missingValue : cursor.getLong(columnIndex);

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close, getInt, getLong, getString, moveToFirst
 
        // Load the display name for the specified person 
        Cursor cursor = contentResolver.query(contactUri,
                new String[]{Contacts._ID, Contacts.DISPLAY_NAME, Contacts.PHOTO_ID}, null, null, null);
        try { 
            if (cursor.moveToFirst()) {
                contactId = cursor.getLong(0);
                contactInfo.setDisplayName(cursor.getString(1));
                contactInfo.setPhotoId(cursor.getInt(2));
            } 
        } finally { 
            cursor.close();
        } 
 
        boolean modified=false;
        cursor = contentResolver.query(Phone.CONTENT_URI,
        		new String[]{Phone.NUMBER},
                Phone.TYPE + "=" + Phone.TYPE_MOBILE+" and "+Phone.CONTACT_ID + "=" + contactId, null, null);
        try { 
        	 if (cursor.moveToNext()){
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close, getInt, moveToFirst
		String[] colNames = new String[] {
				"MIN("+MIN_X+")", "MIN("+MIN_Y+")",
				"MAX("+MAX_X+")", "MAX("+MAX_Y+")"};
		Cursor c = database.query(GLYPHS_TABLE, colNames, COL_PAGE + "=" + page,
				null, null, null, null); 
		if (!c.moveToFirst()) return null;
		Rect r = new Rect(c.getInt(0), c.getInt(1), c.getInt(2), c.getInt(3));
		c.close();
		return r;
	} 
	 
	public void closeDatabase() { 
		if (database != null)
			database.close();
	} 
} 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:close, getBlob, getInt, getString, moveToFirst
 
        Cursor cur = mDB.rawQuery("SELECT "
                + join(Consumers.PACKAGE_NAME, Consumers.IS_SERVICE_PUBLIC, 
                        Consumers.OWNS_CONSUMER_KEY, Consumers.REGISTRY_ID, Consumers.SIGNATURE) 
                + " FROM consumers", null); 
        assertTrue(cur.moveToFirst());
        assertEquals(PACKAGE_UNDER_TEST, cur.getString(0));
        assertEquals(0, cur.getInt(1));
        assertEquals(1, cur.getInt(2));
        assertEquals(1, cur.getInt(3));
        assertEquals(new Signature(SIGNATURE_FOR_PACKAGE), new Signature(cur.getBlob(4)));
        cur.close();
    } 
 
    public void testShouldUpdateCorrectly() throws Exception { 
        setPackage(PACKAGE_UNDER_TEST);
        setSignature(SIGNATURE_FOR_PACKAGE);
 
        ContentValues value = new ContentValues();
        value.put(Registry.ACCESS_TOKEN_URL, "http://access");
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
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
Connect your IDE to all the code out there  Get Codota for Java

Related Cursor getInt Questions & Answers:

Other Cursor getInt Examples

130:	
131:			Todo td = new Todo();
132:			td.setId(c.getInt(c.getColumnIndex(KEY_ID)));
133:			td.setNote((c.getString(c.getColumnIndex(KEY_TODO))));
134:			td.setCreatedAt(c.getString(c.getColumnIndex(KEY_CREATED_AT)));
-
153:				do {
154:					Todo td = new Todo();
155:					td.setId(c.getInt((c.getColumnIndex(KEY_ID))));
156:					td.setNote((c.getString(c.getColumnIndex(KEY_TODO))));
157:					td.setCreatedAt(c.getString(c.getColumnIndex(KEY_CREATED_AT)));
-
186:				do {
187:					Todo td = new Todo();
188:					td.setId(c.getInt((c.getColumnIndex(KEY_ID))));
189:					td.setNote((c.getString(c.getColumnIndex(KEY_TODO))));
190:					td.setCreatedAt(c.getString(c.getColumnIndex(KEY_CREATED_AT)));
-
271:				do {
272:					Tag t = new Tag();
273:					t.setId(c.getInt((c.getColumnIndex(KEY_ID))));
274:					t.setTagName(c.getString(c.getColumnIndex(KEY_TAG_NAME)));
275:

Read More

14:				do {
15:					Tag t = new Tag();
16:					t.setId(c.getInt((c.getColumnIndex(KEY_ID))));
17:					t.setTagName(c.getString(c.getColumnIndex(KEY_TAG_NAME)));
18:

Read More

19:				do {
20:					Todo td = new Todo();
21:					td.setId(c.getInt((c.getColumnIndex(KEY_ID))));
22:					td.setNote((c.getString(c.getColumnIndex(KEY_TODO))));
23:					td.setCreatedAt(c.getString(c.getColumnIndex(KEY_CREATED_AT)));

Read More

getInt Method Overview
Returns the value of the requested column as an int.
See Code Examples for other Android Cursor Methods: