View Code
cur1.moveToFirst();
photo_id = cur1.getString( 0 );
}
String[] projection = new String[] {
ContactsContract.Data.DATA15
};
String selection = " ContactsContract.Data._ID = " + photo_id;
Cursor cur = cr.query(
ContactsContract.Data.CONTENT_URI, projection, selection, null ,
null );
cur.moveToFirst();
if (cur.getCount() < 0 || cur.getCount() == 0 ){
return null ;
}
byte [] contactIcon = cur.getBlob( 0 );
if (contactIcon == null ) {
return null ;
} else {
return contactIcon;
}
}
public byte[] getPersonPhoto(String PersonID)if (cur1.getCount() > 0 ) {
{
String photo_id = null;
String[] projection1 = new String[] {ContactsContract.Contacts.PHOTO_ID};
String selection1 = ContactsContract.Contacts._ID+ " = " + PersonID;
Cursor cur1 = cr.query(
ContactsContract.Contacts.CONTENT_URI, projection1, selection1,
null, null);
cur1.moveToFirst();
photo_id = cur1.getString( 0 );
}
String[] projection = new String[] {
ContactsContract.Data.DATA15
};
String selection = " ContactsContract.Data._ID = " + photo_id;
Cursor cur = cr.query(
ContactsContract.Data.CONTENT_URI, projection, selection, null ,
null );
cur.moveToFirst();
if (cur.getCount() < 0 || cur.getCount() == 0 ){
return null ;
}
byte [] contactIcon = cur.getBlob( 0 );
if (contactIcon == null ) {
return null ;
} else {
return contactIcon;
}
}