Created
January 2, 2012 21:50
-
-
Save ermau/1552267 to your computer and use it in GitHub Desktop.
Get a list of names, phones and emails on Android with Xamarin.Mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TextView t = FindViewById<TextView> (Resource.Id.status); | |
StringBuilder builder = new StringBuilder(); | |
var book = new AddressBook (this); | |
book.PreferContactAggregation = true; | |
foreach (Contact c in book.Where (c => c.FirstName == "Eric")) | |
{ | |
builder.AppendLine (c.DisplayName); | |
foreach (Phone p in c.Phones) | |
builder.AppendLine ("Phone: " + p.Number); | |
foreach (Email e in c.Emails) | |
builder.AppendLine ("Email: " + e.Address); | |
builder.AppendLine(); | |
} | |
t.Text = builder.ToString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment