-
I want to insert a contact into Contact list, the contact includes contact avatar uri, but i did not see a method which set photo with uri, only bitmap and bytearray. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hey! Thanks for asking this question! I think other people will ask the same question 😁 Before I provide you an answer, I will work on #10 first so I can provide you the most correct and accurate answer. I'm working on it now 🔥 🔥🔥🔥🔥🔥🔥🔥 |
Beta Was this translation helpful? Give feedback.
-
@lau1944, I've provided complete documentation on how to get/set/remove Contact/RawContact photos in #10. Here is the link to the howto page; https://github.com/vestrel00/contacts-android/blob/main/howto/howto-get-set-remove-contact-raw-contact-photo.md I added a link to this issue at the bottom of that howto page. I also provided an answer to the question. I will copy and paste it here. I hope this answers your question 😁 Issue #110: Can photo be set using a uri instead of bytes and bitmaps?No and yes. The core APIs provided in this library only provides functions that the Contacts Provider natively supports. This means setting Contact or RawContact photo only using bytes (and other similar types). See documentation in Photos are stored and managed by the Contacts Provider, which in turn provides specific URIs for RawContacts and Contacts for read/write access to those photos. We cannot simply just pass in our own URIs. The Contacts Provider will not accept it. The Contacts Provider will only accept raw photo data. It will then generate and manage URIs on its own automatically to enforce data integrity. Consumers may write their own functions to convert a URI to a byte array or bitmap using whatever imaging libraries they want. Certain URIs/URLs may require networking and heavy image processing, which this Contacts library will not cover! URI/URL to image conversion simply does not belong in this library! |
Beta Was this translation helpful? Give feedback.
-
Terrific ~~ |
Beta Was this translation helpful? Give feedback.
@lau1944, I've provided complete documentation on how to get/set/remove Contact/RawContact photos in #10. Here is the link to the howto page; https://github.com/vestrel00/contacts-android/blob/main/howto/howto-get-set-remove-contact-raw-contact-photo.md
I added a link to this issue at the bottom of that howto page. I also provided an answer to the question. I will copy and paste it here. I hope this answers your question 😁
Issue #110: Can photo be set using a uri instead of bytes and bitmaps?
No and yes. The core APIs provided in this library only provides functions that the Contacts Provider natively supports. This means setting Contact or RawContact photo only using bytes (and other sim…