List of usage examples for android.database Cursor getBlob
byte[] getBlob(int columnIndex);
From source file:Main.java
protected static byte[] getBlob(Cursor mCursor, String column) { return mCursor.getBlob(mCursor.getColumnIndex(column)); }
From source file:Main.java
public static byte[] getBlob(Cursor cursor, String columnName) { return cursor.getBlob(cursor.getColumnIndexOrThrow(columnName)); }
From source file:Main.java
public static byte[] getBlob(@NonNull Cursor cursor, @NonNull String columnName) { return cursor.getBlob(cursor.getColumnIndex(columnName)); }
From source file:Main.java
public static byte[] getBolbFromCursor(final Cursor cur, final String column) { final int idx = cur.getColumnIndex(column); return (idx == -1) ? null : cur.getBlob(idx); }
From source file:com.interapt.android.InsiderLouisville.utils.UiUtils.java
static public Bitmap getFaviconBitmap(long feedId, Cursor cursor, int iconCursorPos) { Bitmap bitmap = UiUtils.sFaviconCache.get(feedId); if (bitmap == null) { byte[] iconBytes = cursor.getBlob(iconCursorPos); if (iconBytes != null && iconBytes.length > 0) { bitmap = UiUtils.getScaledBitmap(iconBytes, 18); UiUtils.sFaviconCache.put(feedId, bitmap); }//w w w. j a v a 2 s. com } return bitmap; }
From source file:Main.java
static Object getObject(Cursor cursor, int columnIndex) throws Exception { int type = getType(cursor, columnIndex); Object value;/* w w w .j a va 2 s . c o m*/ switch (type) { case Cursor.FIELD_TYPE_BLOB: value = cursor.getBlob(columnIndex); break; case Cursor.FIELD_TYPE_FLOAT: value = cursor.getFloat(columnIndex); break; case Cursor.FIELD_TYPE_INTEGER: value = cursor.getLong(columnIndex); break; case Cursor.FIELD_TYPE_NULL: value = null; break; case Cursor.FIELD_TYPE_STRING: value = cursor.getString(columnIndex); break; default: value = cursor.getString(columnIndex); } return value; }
From source file:com.carlrice.reader.utils.UiUtils.java
static public Bitmap getFaviconBitmap(long feedId, Cursor cursor, int iconCursorPos) { Bitmap bitmap = UiUtils.FAVICON_CACHE.get(feedId); if (bitmap == null) { byte[] iconBytes = cursor.getBlob(iconCursorPos); if (iconBytes != null && iconBytes.length > 0) { bitmap = UiUtils.getScaledBitmap(iconBytes, 18); UiUtils.FAVICON_CACHE.put(feedId, bitmap); }/*w w w .j a v a 2 s . c o m*/ } return bitmap; }
From source file:Main.java
private static InputStream openPhoto(final Context context, final Uri contactUri) { Uri photoUri = Uri.withAppendedPath(contactUri, ContactsContract.Contacts.Photo.CONTENT_DIRECTORY); Cursor cursor = context.getContentResolver().query(photoUri, new String[] { ContactsContract.Contacts.Photo.PHOTO }, null, null, null); if (cursor == null) { return null; }//ww w . jav a 2 s . co m try { if (cursor.moveToFirst()) { byte[] data = cursor.getBlob(0); if (data != null) { return new ByteArrayInputStream(data); } } } finally { cursor.close(); } return null; }
From source file:Main.java
public static byte[] getPersonPhoto(Context context, String id) { if (id == null) return null; byte photo[] = null; Cursor cursor = context.getContentResolver().query(Uri.withAppendedPath(Contacts.Photos.CONTENT_URI, id), new String[] { PhotosColumns.DATA }, null, null, null); if (cursor != null) { try {//from w w w. j ava 2s .co m if (cursor.getCount() > 0) { cursor.moveToFirst(); photo = cursor.getBlob(0); if (photo != null) { return photo; // Log.v("Found photo for person: " + id); // bitmap = BitmapFactory.decodeStream(new // ByteArrayInputStream(photo)); } } } finally { cursor.close(); } } return photo; }
From source file:Main.java
/** * Get the cursor/*from w w w .ja va 2s. com*/ * @param cursor Cursor from where read value * @param index int to read * @return Object read */ private static Object getCursorValue(Cursor cursor, int index) { switch (cursor.getType(index)) { case Cursor.FIELD_TYPE_INTEGER: return Integer.valueOf(cursor.getInt(index)); case Cursor.FIELD_TYPE_FLOAT: return Float.valueOf(cursor.getFloat(index)); case Cursor.FIELD_TYPE_STRING: return cursor.getString(index); case Cursor.FIELD_TYPE_BLOB: return cursor.getBlob(index); default: return null; } }