开发者

Android Java: I need to save a bitmap alongwith name,mobile no.s to the contact list

开发者 https://www.devze.com 2023-04-10 05:43 出处:网络
Android: Java I\'m able to save name,mobile no.s to my Contact List. however, i\'m Unable to save logo/bitmap to the (new item in the) Contact List.

Android: Java

I'm able to save name,mobile no.s to my Contact List.

  • however, i'm Unable to save logo/bitmap to the (new item in the) Contact List.

Could you send me a snippet of code to save the bitmap/logo, too, to the C开发者_运维技巧ontact List?

Thanks, Kumar


ContentValues values = new ContentValues();
values.put(People.NAME, "Serkan Ozel");
Uri uri = getContentResolver().insert(People.CONTENT_URI, values); 

Bitmap photo = myImage.getBitmap();
if (photo != null) {
  ByteArrayOutputStream stream = new ByteArrayOutputStream();
  photo.compress(Bitmap.CompressFormat.JPEG, 75, stream);
  People.setPhotoData(getContentResolver(), uri, stream.toByteArray
());

} 
0

精彩评论

暂无评论...
验证码 换一张
取 消