[mono-android] selecting contacts

John Murray john at murray.gb.com
Thu Mar 31 14:48:27 EDT 2011


Further to my last post = just me being blind 

I have been blind for hte last 4 hours on this one !!!!!

 

Of course I should have overridden and stuck in a line base 

Thus 

So if you want have a contacts select dialog this works 

If anyone would like to suggest improvements please do 

 

 

private void butt1click()

        {

            Intent intent = new Intent(Intent.ActionPick);

            intent.SetType(ContactsContract.Contacts.ContentType);

            StartActivityForResult(intent, 5555);

        }

        

        

        protected override void OnActivityResult(int requestCode, Result
resultCode, Intent intent)

       

        {

            base.OnActivityResult( requestCode, resultCode,  intent);

            if (requestCode == 5555)

            {

                

                ICursor cursor = ManagedQuery(intent.Data, null, null, null,
null);

                cursor.MoveToNext();

                string name = "some name";

       name =
cursor.GetString(cursor.GetColumnIndexOrThrow(ContactsContract.ContactsColum
nsConsts.DisplayName));

       

                e1.Text = name; 

            }

        }//onActivityResult

        

 

Cheers 

John Murray 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110331/c878dc22/attachment.html 


More information about the Monodroid mailing list