O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

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

Save User-Entered Data

The intTextChangedEvents method you just created sets the stage for saving the contact’s data. It sets the EditTexts to update the ContactActivity’s contact object with any changes users make as they make them. All that is left is to pass that object to the insert or update method in the ContactDataSource class so that the changes can be stored in the database. This requires the addition of a method that initializes the Save button and executes the code that will do the save operation when the button is pressed.

The initialization of the Save button is similar to the initialization of all the other buttons you have coded so far. The only difference is what happens when the button is pressed. Enter the code in Listing 5.6 ...

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