Fix issue in contact helper, where contact wasn't found if he didn't had a picture
This commit is contained in:
parent
1410765d5d
commit
fb40893c3f
1 changed files with 7 additions and 5 deletions
|
@ -228,17 +228,19 @@ public final class ContactHelper {
|
||||||
Uri contactUri = ContentUris.withAppendedId(android.provider.ContactsContract.Contacts.CONTENT_URI, id);
|
Uri contactUri = ContentUris.withAppendedId(android.provider.ContactsContract.Contacts.CONTENT_URI, id);
|
||||||
Uri photoUri = Uri.withAppendedPath(contactUri, android.provider.ContactsContract.Contacts.Photo.CONTENT_DIRECTORY);
|
Uri photoUri = Uri.withAppendedPath(contactUri, android.provider.ContactsContract.Contacts.Photo.CONTENT_DIRECTORY);
|
||||||
if (photoUri == null) {
|
if (photoUri == null) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
String[] photoProj = {android.provider.ContactsContract.CommonDataKinds.Photo.PHOTO};
|
String[] photoProj = {android.provider.ContactsContract.CommonDataKinds.Photo.PHOTO};
|
||||||
Cursor cursor = resolver.query(photoUri, photoProj, null, null, null);
|
Cursor cursor = resolver.query(photoUri, photoProj, null, null, null);
|
||||||
valid = testPhotoUriAndCloseCursor(cursor);
|
valid = testPhotoUriAndCloseCursor(cursor);
|
||||||
|
displayName = c.getString(c.getColumnIndex(android.provider.ContactsContract.PhoneLookup.DISPLAY_NAME));
|
||||||
if (valid) {
|
if (valid) {
|
||||||
displayName = c.getString(c.getColumnIndex(android.provider.ContactsContract.PhoneLookup.DISPLAY_NAME));
|
|
||||||
foundPhotoUri = photoUri;
|
foundPhotoUri = photoUri;
|
||||||
c.close();
|
} else {
|
||||||
return true;
|
foundPhotoUri = null;
|
||||||
}
|
}
|
||||||
|
c.close();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
c.close();
|
c.close();
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue