Как получить миниатюру контакта Android

У меня есть адаптер listview, и я пробую следующее в методе newView:

@Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {

        final LayoutInflater inflater = LayoutInflater.from(context);
        View v = inflater.inflate(layout, parent, false);

        long contactId = Long.valueOf(cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID))); 
        String contactName = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); 
        boolean hasPhone = Boolean.parseBoolean(cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))); 
        String thumbnailUri = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.PHOTO_THUMBNAIL_URI)); 

        TextView name_text = (TextView) v.findViewById(R.id.name_entry);
        if (name_text != null) {
            name_text.setText(contactName);
        }

        name_text.setTag(new Contact(contactId, hasPhone));

        ImageView thumbnail = (ImageView) v.findViewById(R.id.thumbnail);
        if (thumbnailUri != null) {
            thumbnail.setImageURI(Uri.parse(thumbnailUri));
        } else {
            thumbnail.setImageResource(R.drawable.ic_launcher);
        }

        return v;
    }

Но когда я пытаюсь проанализировать Uri, хранящийся в thumbnailUri, я получаю следующую ошибку:

   08-09 01:58:38.619: I/System.out(1471): resolveUri failed on bad bitmap uri: content://com.android.contacts/contacts/1/photo

Я иду об этом неправильно? Любая помощь будет принята с благодарностью!

11
задан Christoffer Lette 8 August 2012 в 14:13
поделиться