List of usage examples for android.database Cursor getBlob
byte[] getBlob(int columnIndex);
From source file:org.sufficientlysecure.keychain.ui.ViewKeyAdvShareFragment.java
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { // Avoid NullPointerExceptions... if (data == null || data.getCount() == 0) { return;//from ww w .j a v a 2s.c om } // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) switch (loader.getId()) { case LOADER_ID_UNIFIED: { if (data.moveToFirst()) { byte[] fingerprintBlob = data.getBlob(INDEX_UNIFIED_FINGERPRINT); setFingerprint(fingerprintBlob); mUserId = data.getString(INDEX_UNIFIED_USER_ID); break; } } } setContentShown(true); }
From source file:org.sufficientlysecure.keychain.ui.ViewKeyShareFragment.java
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { /* TODO better error handling? May cause problems when a key is deleted, * because the notification triggers faster than the activity closes. *//*from w ww . j a va2 s . co m*/ // Avoid NullPointerExceptions... if (data.getCount() == 0) { return; } // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) switch (loader.getId()) { case LOADER_ID_UNIFIED: { if (data.moveToFirst()) { byte[] fingerprintBlob = data.getBlob(INDEX_UNIFIED_FINGERPRINT); String fingerprint = PgpKeyHelper.convertFingerprintToHex(fingerprintBlob); mFingerprint.setText(PgpKeyHelper.colorizeFingerprint(fingerprint)); String qrCodeContent = Constants.FINGERPRINT_SCHEME + ":" + fingerprint; mFingerprintQrCode.setImageBitmap(QrCodeUtils.getQRCodeBitmap(qrCodeContent, QR_CODE_SIZE)); break; } } } setContentShown(true); }
From source file:org.sufficientlysecure.keychain.ui.ViewKeyAdvSubkeysFragment.java
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { // Avoid NullPointerExceptions, if we get an empty result set. if (data.getCount() == 0) { return;/*from w w w.j av a2 s. c o m*/ } switch (loader.getId()) { case LOADER_ID_UNIFIED: { data.moveToFirst(); mMasterKeyId = data.getLong(INDEX_MASTER_KEY_ID); mHasSecret = data.getInt(INDEX_HAS_ANY_SECRET) != 0; mFingerprint = data.getBlob(INDEX_FINGERPRINT); break; } case LOADER_ID_SUBKEYS: { // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) mSubkeysAdapter.swapCursor(data); // TODO: maybe show not before both are loaded! setContentShown(true); break; } } }
From source file:org.sufficientlysecure.keychain.ui.keyview.loader.IdentityLoader.java
private void loadLinkedIds(ArrayList<IdentityInfo> identities) { Cursor cursor = contentResolver.query(UserPackets.buildLinkedIdsUri(masterKeyId), USER_PACKETS_PROJECTION, USER_IDS_WHERE, null, null); if (cursor == null) { Log.e(Constants.TAG, "Error loading key items!"); return;// ww w .jav a 2s .com } try { while (cursor.moveToNext()) { int rank = cursor.getInt(INDEX_RANK); int verified = cursor.getInt(INDEX_VERIFIED); boolean isPrimary = cursor.getInt(INDEX_IS_PRIMARY) != 0; byte[] data = cursor.getBlob(INDEX_ATTRIBUTE_DATA); try { UriAttribute uriAttribute = LinkedAttribute.fromAttributeData(data); if (uriAttribute instanceof LinkedAttribute) { LinkedIdInfo identityInfo = LinkedIdInfo.create(rank, verified, isPrimary, uriAttribute); identities.add(identityInfo); } } catch (IOException e) { Log.e(Constants.TAG, "Failed parsing uri attribute", e); } } } finally { cursor.close(); } }
From source file:org.sufficientlysecure.keychain.provider.ProviderHelper.java
public byte[] getApiAppSignature(String packageName) { Uri queryUri = ApiApps.buildByPackageNameUri(packageName); String[] projection = new String[] { ApiApps.PACKAGE_SIGNATURE }; Cursor cursor = mContentResolver.query(queryUri, projection, null, null, null); try {/*from w ww . ja v a 2s .c o m*/ byte[] signature = null; if (cursor != null && cursor.moveToFirst()) { int signatureCol = 0; signature = cursor.getBlob(signatureCol); } return signature; } finally { if (cursor != null) { cursor.close(); } } }
From source file:com.ericsender.android_nanodegree.popmovie.com.ericsender.android_nanodegree.popmovie.data.TestProvider.java
public void testGettingReviews() { testAddingReviewToMovieRow();/*from ww w . j av a 2 s. c om*/ Cursor c = mContext.getContentResolver().query(MovieContract.MovieEntry.buildUriReviews(curr_movie_id), null, null, null, null); assertTrue("cursor returned for movie id = " + curr_movie_id, c.moveToFirst()); byte[] blob = c.getBlob(1); assertNotNull("ensure object returned", blob); assertEquals(expected_reviews.length, blob.length); for (int i = 0; i < expected_reviews.length; i++) assertEquals(expected_reviews[i], blob[i]); c.close(); }
From source file:com.ericsender.android_nanodegree.popmovie.com.ericsender.android_nanodegree.popmovie.data.TestProvider.java
public void testGettingTrailers() { testAddingTrailersToMovieRow();// ww w . j a v a2 s.c om Cursor c = mContext.getContentResolver().query(MovieContract.MovieEntry.buildUriTrailers(curr_movie_id), null, null, null, null); assertTrue("cursor returned for movie id = " + curr_movie_id, c.moveToFirst()); byte[] blob = c.getBlob(1); assertNotNull("ensure object returned", blob); assertEquals(expected_trailer.length, blob.length); for (int i = 0; i < expected_trailer.length; i++) assertEquals(expected_trailer[i], blob[i]); c.close(); }
From source file:com.modestmaps.providers.connection.TileBaseHelper.java
public Bitmap getTile(String tileQ) throws OutOfMemoryError { //bmg.recycle(); byte[] tile = { -119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 1, 0, 0, 0, 1, 0, 8, 3, 0, 0, 0, 107, -84, 88, 84, 0, 0, 0, 25, 116, 69, 88, 116, 83, 111, 102, 116, 119, 97, 114, 101, 0, 65, 100, 111, 98, 101, 32, 73, 109, 97, 103, 101, 82, 101, 97, 100, 121, 113, -55, 101, 60, 0, 0, 3, 32, 105, 84, 88, 116, 88, 77, 76, 58, 99, 111, 109, 46, 97, 100, 111, 98, 101, 46, 120, 109, 112, 0, 0, 0, 0, 0, 60, 63, 120, 112, 97, 99, 107, 101, 116, 32, 98, 101, 103, 105, 110, 61, 34, -17, -69, -65, 34, 32, 105, 100, 61, 34, 87, 53, 77, 48, 77, 112, 67, 101, 104, 105, 72, 122, 114, 101, 83, 122, 78, 84, 99, 122, 107, 99, 57, 100, 34, 63, 62, 32, 60, 120, 58, 120, 109, 112, 109, 101, 116, 97, 32, 120, 109, 108, 110, 115, 58, 120, 61, 34, 97, 100, 111, 98, 101, 58, 110, 115, 58, 109, 101, 116, 97, 47, 34, 32, 120, 58, 120, 109, 112, 116, 107, 61, 34, 65, 100, 111, 98, 101, 32, 88, 77, 80, 32, 67, 111, 114, 101, 32, 53, 46, 48, 45, 99, 48, 54, 48, 32, 54, 49, 46, 49, 51, 52, 55, 55, 55, 44, 32, 50, 48, 49, 48, 47, 48, 50, 47, 49, 50, 45, 49, 55, 58, 51, 50, 58, 48, 48, 32, 32, 32, 32, 32, 32, 32, 32, 34, 62, 32, 60, 114, 100, 102, 58, 82, 68, 70, 32, 120, 109, 108, 110, 115, 58, 114, 100, 102, 61, 34, 104, 116, 116, 112, 58, 47, 47, 119, 119, 119, 46, 119, 51, 46, 111, 114, 103, 47, 49, 57, 57, 57, 47, 48, 50, 47, 50, 50, 45, 114, 100, 102, 45, 115, 121, 110, 116, 97, 120, 45, 110, 115, 35, 34, 62, 32, 60, 114, 100, 102, 58, 68, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 32, 114, 100, 102, 58, 97, 98, 111, 117, 116, 61, 34, 34, 32, 120, 109, 108, 110, 115, 58, 120, 109, 112, 61, 34, 104, 116, 116, 112, 58, 47, 47, 110, 115, 46, 97, 100, 111, 98, 101, 46, 99, 111, 109, 47, 120, 97, 112, 47, 49, 46, 48, 47, 34, 32, 120, 109, 108, 110, 115, 58, 120, 109, 112, 77, 77, 61, 34, 104, 116, 116, 112, 58, 47, 47, 110, 115, 46, 97, 100, 111, 98, 101, 46, 99, 111, 109, 47, 120, 97, 112, 47, 49, 46, 48, 47, 109, 109, 47, 34, 32, 120, 109, 108, 110, 115, 58, 115, 116, 82, 101, 102, 61, 34, 104, 116, 116, 112, 58, 47, 47, 110, 115, 46, 97, 100, 111, 98, 101, 46, 99, 111, 109, 47, 120, 97, 112, 47, 49, 46, 48, 47, 115, 84, 121, 112, 101, 47, 82, 101, 115, 111, 117, 114, 99, 101, 82, 101, 102, 35, 34, 32, 120, 109, 112, 58, 67, 114, 101, 97, 116, 111, 114, 84, 111, 111, 108, 61, 34, 65, 100, 111, 98, 101, 32, 80, 104, 111, 116, 111, 115, 104, 111, 112, 32, 67, 83, 53, 32, 87, 105, 110, 100, 111, 119, 115, 34, 32, 120, 109, 112, 77, 77, 58, 73, 110, 115, 116, 97, 110, 99, 101, 73, 68, 61, 34, 120, 109, 112, 46, 105, 105, 100, 58, 70, 49, 69, 65, 51, 53, 51, 69, 56, 54, 55, 68, 49, 49, 69, 51, 66, 48, 57, 48, 68, 49, 48, 56, 50, 49, 57, 67, 67, 68, 56, 50, 34, 32, 120, 109, 112, 77, 77, 58, 68, 111, 99, 117, 109, 101, 110, 116, 73, 68, 61, 34, 120, 109, 112, 46, 100, 105, 100, 58, 70, 49, 69, 65, 51, 53, 51, 70, 56, 54, 55, 68, 49, 49, 69, 51, 66, 48, 57, 48, 68, 49, 48, 56, 50, 49, 57, 67, 67, 68, 56, 50, 34, 62, 32, 60, 120, 109, 112, 77, 77, 58, 68, 101, 114, 105, 118, 101, 100, 70, 114, 111, 109, 32, 115, 116, 82, 101, 102, 58, 105, 110, 115, 116, 97, 110, 99, 101, 73, 68, 61, 34, 120, 109, 112, 46, 105, 105, 100, 58, 70, 49, 69, 65, 51, 53, 51, 67, 56, 54, 55, 68, 49, 49, 69, 51, 66, 48, 57, 48, 68, 49, 48, 56, 50, 49, 57, 67, 67, 68, 56, 50, 34, 32, 115, 116, 82, 101, 102, 58, 100, 111, 99, 117, 109, 101, 110, 116, 73, 68, 61, 34, 120, 109, 112, 46, 100, 105, 100, 58, 70, 49, 69, 65, 51, 53, 51, 68, 56, 54, 55, 68, 49, 49, 69, 51, 66, 48, 57, 48, 68, 49, 48, 56, 50, 49, 57, 67, 67, 68, 56, 50, 34, 47, 62, 32, 60, 47, 114, 100, 102, 58, 68, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 62, 32, 60, 47, 114, 100, 102, 58, 82, 68, 70, 62, 32, 60, 47, 120, 58, 120, 109, 112, 109, 101, 116, 97, 62, 32, 60, 63, 120, 112, 97, 99, 107, 101, 116, 32, 101, 110, 100, 61, 34, 114, 34, 63, 62, -55, 39, 49, -69, 0, 0, 0, 18, 80, 76, 84, 69, -52, -52, -52, 102, 102, 102, -103, -103, -103, 51, 51, 51, 0, 0, 0, 75, 75, 75, -112, 33, 7, 1, 0, 0, 4, -76, 73, 68, 65, 84, 120, -38, -20, -101, -19, -126, -85, 42, 12, 69, 77, -128, -9, 127, -27, 91, 69, -27, 43, 80, -67, -75, -75, 61, -77, -42, -113, 25, -37, 42, -122, 45, 4, -48, -19, 52, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -64, 105, -44, 123, -1, -93, -95, 63, 34, 119, -27, -57, -109, 21, -41, -33, 23, -64, -53, -1, 22, -64, -81, -5, -1, -72, 0, -2, -49, 11, 32, -89, 4, -112, 16, -37, -3, -75, 93, 32, 43, -11, -61, 2, 56, -105, 5, 127, -92, 34, -34, 55, -95, 94, 32, -128, 81, -22, -89, 4, -112, 44, 15, -2, 69, 1, 124, 126, -18, -65, 41, -128, -92, -16, -77, -118, -120, -101, -121, -56, 80, 69, -27, -4, -122, -53, 42, -82, -51, 113, -39, -56, 18, -26, 47, -126, 52, 93, 62, -37, -83, 44, -11, -29, 2, -52, -25, -105, 74, 0, -39, 67, 10, -89, 4, 72, -57, 105, -11, 69, -82, -92, 84, 21, -66, 91, -128, 20, -1, -74, -79, 68, 40, 18, -81, 102, 113, -27, 68, -106, -21, -7, -64, 18, 96, -7, 81, 117, 57, 110, -17, 28, -113, -67, 67, -39, 69, -26, -76, 35, -53, -73, -79, -12, -78, -44, -49, 11, 48, -123, -19, 66, 103, 21, -110, 84, -127, 110, 111, -83, 5, -48, -3, -73, 45, -77, -122, -67, -96, -78, 7, -92, -29, -11, -2, 28, -112, -99, 62, 125, -108, -84, -75, -22, 81, 1, -78, -97, 92, -36, 124, -110, 29, 101, -105, -9, 102, 1, 36, -43, 32, -5, -76, -43, 36, 28, 20, 64, -77, 93, 53, 106, -8, 68, 0, -35, 123, -40, -51, 2, 108, -41, 124, -17, 17, 82, 36, -84, -125, 2, 72, 94, -119, 88, -75, 71, 81, 78, 15, -100, -1, 118, 1, -42, 106, -58, -65, 110, -72, 64, -22, 11, 48, 55, -5, -99, -67, 81, -52, 105, -47, -100, -5, -82, -71, -1, 59, 4, 88, 91, -6, 46, -125, -10, -89, 40, 125, 1, 124, 69, 90, 109, -44, -107, -45, 80, -19, 117, -65, 0, -79, 14, 111, 16, 96, 29, -12, -61, 84, -49, 3, -126, -20, -19, -28, 27, 4, -120, 67, -95, -77, 5, -104, 14, 11, 96, -89, 58, 87, -34, 117, 72, -93, -20, -12, 69, 2, 44, -101, -82, -100, 22, -100, 76, -126, -82, 91, -119, 80, -52, -89, -78, 36, -5, 77, 2, -52, 99, -78, 123, 105, 24, -108, -30, 58, -9, -50, 51, -103, -85, -81, 47, 16, 96, -82, -86, -37, -89, 3, -95, -41, 0, -14, 89, -46, 96, 34, 116, 76, 0, -55, 5, -112, -69, 5, -48, 61, 115, -55, -82, -128, -76, -127, -71, -44, -100, 107, 1, 66, -77, -73, -42, 51, -66, -94, 67, -120, -49, 71, 33, 119, -73, 0, 75, -4, 62, 109, -83, -117, -95, -48, 78, 95, -25, -5, 72, -26, 98, -56, -7, 109, 81, 19, -30, 113, -15, -109, 43, -101, -122, -82, -91, -5, -67, -55, 21, -91, -34, 39, -64, -28, -115, 101, 109, 27, -110, -37, -65, 31, 45, -121, -45, 60, -88, 45, 102, -37, -53, 105, -70, 31, -25, 58, 103, -5, -88, 0, 50, -70, -79, 81, -59, 47, -93, 27, 34, -34, -83, 119, 64, 52, -104, -59, 44, 19, -95, 121, -105, 108, -10, 44, -2, -82, 60, 0, 0, 0, 0, 0, 0, 0, 0, -16, 111, 115, -34, -50, -13, -61, 38, -64, -93, -43, -47, -31, 61, -7, -53, 4, -48, -77, -73, -2, 55, -1, -124, 94, -7, -48, -64, -86, -114, 31, 86, -15, 50, 1, -4, -39, -126, 16, -32, 50, 1, 74, 119, -21, 103, -69, 64, 58, -9, -23, 46, -112, -37, 55, 94, -42, 94, -17, 74, -126, -81, 92, 61, 4, 64, -128, 43, 4, -80, -52, -99, 90, 60, -58, -52, -86, 104, -8, 90, -11, -119, 127, 118, 123, -8, -93, 91, -105, -17, 121, 96, 11, 37, -21, -110, -94, -85, 108, 62, -38, -55, -5, 5, 8, -123, -121, -91, 52, 122, 54, -106, 30, 29, -6, 103, -43, -27, -33, 13, 61, -80, -103, 0, 109, 73, -117, 0, -82, -116, -21, 34, 1, 90, 119, -85, -60, -73, 4, 42, 127, 80, -49, -41, -86, 35, -1, -84, 108, -113, -125, 99, -82, 31, 122, 96, 43, 37, -53, -110, 102, 1, 102, 47, 70, 124, -76, -8, -26, 28, -80, 6, 87, -8, 97, -105, -10, 111, -6, 90, 117, -32, -97, 109, -100, -76, 35, 15, -84, -26, 6, 98, -85, -92, -72, 41, -83, -125, -24, 106, 1, 86, -47, 119, -97, -126, 22, 62, -47, 94, 18, -84, -100, 33, -101, -75, -42, -74, 53, 88, 30, 88, -83, 92, -103, 69, 73, 86, 92, 111, 19, -64, -70, 34, 79, 5, -80, -116, 67, -3, 1, -62, -14, -64, 106, -27, -53, -51, 75, 50, -29, 122, -4, -24, -118, -1, 87, 15, -125, -66, 122, -25, -55, -10, -75, 106, -33, 63, 27, 90, -1, 72, -99, -65, 12, 1, 76, 39, -82, 21, -41, -57, 5, -80, 125, -83, -38, -9, -49, 58, -53, -47, -48, -11, -64, 110, -89, 49, -99, -72, 95, 33, -64, -26, 104, 81, 75, 0, -53, 62, 122, -50, 3, 107, 123, -55, -78, 5, -49, -3, 2, -104, -66, -42, 51, 2, 12, 61, -80, 63, 33, 64, -21, 107, -19, 10, 48, -75, -26, -66, -79, 7, -74, 43, 64, -73, 11, 108, -81, -48, -68, -4, 42, -51, 25, 1, 106, 95, 107, -106, 4, 27, -1, 108, -19, 34, 29, 123, 96, -77, 36, 24, -114, 37, -63, -53, 56, 39, 64, 53, 28, 14, -122, 65, 105, 15, -44, -25, 2, 116, -121, -63, -73, 10, 32, -81, 10, 96, -6, 103, -85, 124, 49, -10, -64, -86, 113, -108, -44, 115, -111, -86, 11, 76, -59, -1, 87, -42, 67, -18, -56, 48, 88, -49, -30, -102, 11, 87, -5, 103, -59, -97, -16, -64, -106, 47, -41, 77, -10, 116, 60, -113, 75, -46, -92, -3, -59, 36, 104, -72, 91, 45, 1, 76, 95, 107, 58, -62, -14, -49, -122, 98, 49, 52, -10, -64, -90, 83, 27, 37, 89, 113, 109, 67, -78, 127, -67, 79, -76, -18, 86, 67, -128, -114, -81, 85, -121, -2, -39, 114, 97, 59, -12, -64, -102, -53, -31, 81, -41, -12, -87, -13, -67, 124, 91, 86, 14, 8, -48, -15, -75, -22, 19, -1, 108, -100, -8, 57, 73, 19, -95, -114, 7, -42, -72, 33, 34, -26, 89, -78, -72, 36, -1, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -65, -59, 127, 2, 12, 0, 35, -109, 40, -115, 21, -105, 28, -78, 0, 0, 0, 0, 73, 69, 78, 68, -82, 66, 96, -126 };//from w w w . j a v a 2 s. c o m System.out.println("byte array tile[] initialized..now loading default nullTile.png.."); System.out.println("nullTile.png loaded as byte array"); System.out.println("tileQ: " + tileQ + " !!"); //TODO: catch if tileQ = null if (tileQ != null) { Cursor cursor = this.tileDB.query(tableName, new String[] { columnName }, tileQ, null, null, null, null); cursor.moveToFirst(); //TODO: this todo note should be movoed to readme.txt: //try to limit the number of tiles pre-loaded into memory by InteractiveMapProvider.. try { tile = cursor.getBlob(0); } catch (Exception e) { System.out.println( "null cursor returned..no such tile found in db..returning nulltile..\n" + e.getMessage()); } cursor.close(); } //ByteArrayInputStream bmgIS = new ByteArrayInputStream(tile); bmg = null; //if(Runtime.getRuntime().freeMemory()>24576){ // try{ bmg = BitmapFactory.decodeByteArray(tile, 0, tile.length, bmgOptions); // }catch(OutOfMemoryError e){ //// p.map = null; // map = null; // bmg.recycle(); // System.out.println("decodeByteArray out of memory..please wait.."); // } tile = null; return bmg; }
From source file:com.android.browser.BookmarksPageCallbacks.java
private void editBookmark(BrowserBookmarksAdapter adapter, int position) { Intent intent = new Intent(getActivity(), AddBookmarkPage.class); Cursor cursor = adapter.getItem(position); Bundle item = new Bundle(); item.putString(BrowserContract.Bookmarks.TITLE, cursor.getString(BookmarksLoader.COLUMN_INDEX_TITLE)); item.putString(BrowserContract.Bookmarks.URL, cursor.getString(BookmarksLoader.COLUMN_INDEX_URL)); byte[] data = cursor.getBlob(BookmarksLoader.COLUMN_INDEX_FAVICON); if (data != null) { item.putParcelable(BrowserContract.Bookmarks.FAVICON, BitmapFactory.decodeByteArray(data, 0, data.length)); }//from w ww . j a v a 2 s .c o m item.putLong(BrowserContract.Bookmarks._ID, cursor.getLong(BookmarksLoader.COLUMN_INDEX_ID)); item.putLong(BrowserContract.Bookmarks.PARENT, cursor.getLong(BookmarksLoader.COLUMN_INDEX_PARENT)); intent.putExtra(AddBookmarkPage.EXTRA_EDIT_BOOKMARK, item); intent.putExtra(AddBookmarkPage.EXTRA_IS_FOLDER, cursor.getInt(BookmarksLoader.COLUMN_INDEX_IS_FOLDER) == 1); startActivity(intent); }
From source file:com.ogunwale.android.app.yaps.ui.PhotosSimpleCursorAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { final ViewBinder binder = getViewBinder(); final int count = mTo.length; final int[] from = mFrom; final int[] to = mTo; for (int i = 0; i < count; i++) { final View v = view.findViewById(to[i]); if (v != null) { boolean bound = false; if (binder != null) { bound = binder.setViewValue(v, cursor, from[i]); }/*from w w w .j a v a 2 s.c o m*/ if (!bound) { if (v instanceof TextView) { String text = cursor.getString(from[i]); if (text == null) text = ""; setViewText((TextView) v, text); } else if (v instanceof ImageView) { byte[] blob = cursor.getBlob(from[i]); if (blob != null && blob.length > 0) setViewImage((ImageView) v, blob); else setDefaultBackground(context, (RelativeLayout) v); } else if (v instanceof RelativeLayout) { byte[] blob = cursor.getBlob(from[i]); if (blob != null && blob.length > 0) setLayoutBackground(context, (RelativeLayout) v, blob); else setDefaultBackground(context, (RelativeLayout) v); } else { throw new IllegalStateException(v.getClass().getName() + " is not a " + " view that can be bounds by this SimpleCursorAdapter"); } } } } }