Java tutorial
//package com.java2s; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract; import java.io.ByteArrayInputStream; import java.io.InputStream; public class Main { 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; } try { if (cursor.moveToFirst()) { byte[] data = cursor.getBlob(0); if (data != null) { return new ByteArrayInputStream(data); } } } finally { cursor.close(); } return null; } }