I am using Contacts.Photo.PHOTO
column name of android.provider.ContactsContact.Contacts
class to get photo of phone contact. Minimum sdk-version of my application is 10, so when using this constant it gives me warning of 'This API added in 11 (Current is min 10)'.
I check of Android docs and found that this Constant is added in API 11, but with great surprize it working well in devices having Android 2.3.6 (i.e. sdk 10).
How is that possible?
See my code:
Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, someContactId);
Uri photoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.CONTENT_DIRECTORY);
Cursor cursor = getContentResolver().query(photoUri, new String[] {Contacts.Photo.PHOTO}, null, null, null);
Log.d(null, cursor.getColumnName(0)); //This returns 'data15' column.
cursor.moveToFirst(); // considering cursor is not null
Byte[] data = cursor.getBlob(0);
InputSteam inputStream = new ByteArrayInputStream(data);
Bitmap bitmapImage = BitmapFactory.decodeStream(inputStream);
imageView.setImageBitmap(bitmapImage); //imageView is of ImageView object i.e. displayed in view.
My min-sdkversion is 10 and target-sdkversion is 10.
This same thing is happening with Intents.Insert.DATA
constant of android.provider.ContactsContact.Intents
class