O'Reilly logo

Xamarin Studio for Android Programming: A C# Cookbook by Mathieu Nayrolles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending an SMS

With this fourth recipe on TheInternship project, we will pick a contact from the contact list of the user and send an SMS to him/her.

How to do it...

Let's look at how to send an SMS.

  1. Create a new activity named SendActivity and add the following code to the OnCreate() method:
    // On click of the contact field, run a contact selection Intnet. FindViewById<TextView> (Resource.Id.ppl1).Click += delegate { //Concrete description of our Intent. Here we want to pick an User Intent contact_intent = new Intent(Intent.ActionPick, ContactsContract.Contacts.ContentUri); //More specifically, we would like the phone number contact_intent.SetType(ContactsContract.CommonDataKinds.Phone.ContentType); // Start the Intent and provide a response code. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required