Forum Libraries, Components, and Plugins

Xamarin.Contacts, How to get thumbnail path URI


I am using Xamarin.Contacts api to read all contacts from phone in Xamarin forms. I need to resolve 2 issues as below

a) Unable to get thumbnail image path so that I can reload my contact profile image using that path later onwards.

b) Once the contacts I bind to my Listview and user start scrolling, the thumbnail image gets swapping between the rows.. for e.g. Contact C1 have thumbnail T1,Contact C2 having thumbnail T2, after scrolling both the contacts have same thumbnail image T1..likewise it is happening.

Source Code

        ctEnumerable =<Contact>().OrderBy(x => string.IsNullOrEmpty(x.DisplayName)? "ZZZZ": x.DisplayName);

                IEnumerator<Contact> ieCt = ctEnumerable.GetEnumerator();

                while (ieCt.MoveNext())

        Contact ct = ieCt.Current;

                    IEnumerable<Phone> contactPhoneNos = ct.Phones.DistinctBy(x => x.Number);

                    if (contactPhoneNos!= null && contactPhoneNos.Count() > 0)
                        foreach (Phone contactPhoneNumber in contactPhoneNos)

                            if (ct.GetThumbnail() != null && ct.GetThumbnail().AsPNG() != null)
                //Populate my class properties
                                phContact.ThumbnailContact = ImageSource.FromStream(() => ct.GetThumbnail().AsPNG().AsStream());

            //Add to my list which is bind with Listview                




Any help will be really appreciable.

Thank You



Sign In or Register to comment.