I've seen the previous thread - and not much else on the topic. So it seems
extracting information from contacts is still a pain. Then I discovered
Xamarin.Mobile and figured it would be the solution to all my problems.

So I wrote some code that is basically the same as 
https://gist.github.com/1449755

Here's my problem - in OnActivityResult

                var book = new AddressBook(this);
                book.PreferContactAggregation = true;

                Contact myContact = book.Load(data.Data.LastPathSegment);

myContact remains null at all times.

And if I I try to go the traditional route, then look up the display name

(
                string id = data.Data.LastPathSegment;
                var contacts =
ManagedQuery(ContactsContract.Contacts.ContentUri, null, "_id = ?", new
string[] { id }, null);
                contacts.MoveToFirst();

                string displayName =
contacts.GetString(contacts.GetColumnIndex("display_name"));
myContact = book.FirstOrDefault(c => c.DisplayName == displayName);
)
then I get a TargetInvocationException on the last line.

Any ideas how I can get all phone numbers and types from the contact that
the user has selected?



--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/Contact-woes-tp5710996.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to