beh3000
چهارشنبه 22 مهر 1394, 13:38 عصر
سلام
من برای گرفتن تصویر پروفایل مخاطبینم از کد زیر استفاده میکنم توی ایمولیتور تصویر پروفایل رو نشون میده ولی توی گوشی واقعی تست میکنم نشون نمیده چیزی
public void fetchContacts(final String number,final int position) {
Uri CONTENT_URI = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_UR I, Uri.encode(number));
ContentResolver contentResolver = getContentResolver();
Cursor cursor = contentResolver.query(CONTENT_URI, new String[]{ PhoneLookup.DISPLAY_NAME, PhoneLookup._ID}, null, null, null);
if (cursor.getCount() > 0)
{
cursor.moveToFirst();
long id = cursor.getLong(cursor.getColumnIndexOrThrow(PhoneL ookup._ID));
String name = cursor.getString(cursor.getColumnIndexOrThrow(Phon eLookup.DISPLAY_NAME));
Uri uri = ContentUris.withAppendedId(People.CONTENT_URI, id);
bmp= People.loadContactPhoto(ActivityMain.this, uri, R.drawable.profile, null);
}
}
من برای گرفتن تصویر پروفایل مخاطبینم از کد زیر استفاده میکنم توی ایمولیتور تصویر پروفایل رو نشون میده ولی توی گوشی واقعی تست میکنم نشون نمیده چیزی
public void fetchContacts(final String number,final int position) {
Uri CONTENT_URI = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_UR I, Uri.encode(number));
ContentResolver contentResolver = getContentResolver();
Cursor cursor = contentResolver.query(CONTENT_URI, new String[]{ PhoneLookup.DISPLAY_NAME, PhoneLookup._ID}, null, null, null);
if (cursor.getCount() > 0)
{
cursor.moveToFirst();
long id = cursor.getLong(cursor.getColumnIndexOrThrow(PhoneL ookup._ID));
String name = cursor.getString(cursor.getColumnIndexOrThrow(Phon eLookup.DISPLAY_NAME));
Uri uri = ContentUris.withAppendedId(People.CONTENT_URI, id);
bmp= People.loadContactPhoto(ActivityMain.this, uri, R.drawable.profile, null);
}
}