画像の URI があります。Android で写真として設定したいのですが、どうすればよいですか? ここに私の機能があります
Cursor cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",new String[]{id}, null);
if(cursor.moveToNext())
{
mContactName = cursor.getString(cursor.getColumnIndex((ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)));
mPhotoUri = Uri.withAppendedPath(result, ContactsContract.Contacts.Photo.CONTENT_DIRECTORY);
mContactNumber = cursor.getString(cursor.getColumnIndex((ContactsContract.CommonDataKinds.Phone.NUMBER)));
Log.i("Dante", "ContactName = "+ mContactName );
Log.i("Dante", "mContactNumber ="+mContactNumber);
Log.i("Dante", " PhotoURI "+mPhotoUri );
}
ContentResolver cr = mContext.getContentResolver();
int i = collagelistadaper.getItemPositon();
ContentValues values = new ContentValues();
values.put(ContactsContract.Contacts.Photo.CONTENT_DIRECTORY, Uri.fromFile(quiltFolder.listFiles()[i]).toString()); //ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI).withValue(ContactsContract.Contacts.Photo.CONTENT_DIRECTORY, values);
Uri result1 = cr.insert(ContactsContract.Data.CONTENT_URI ,values);
// getContentResolver().update(mPhotoUri,values,null,null);
mPhotoUri = Uri.withAppendedPath(result,ContactsContract.Contacts.Photo.CONTENT_DIRECTORY);