Accessing the contacts / address book
There will be times when you want the user to access existing data from their device to populate some fields or a database within your own application. Possibly the best example of this is the utilization of the address book and contact details.
If you have built, for example, an application that was primarily meant for sharing data over e-mail, using the address book in the device would allow the user to select contacts that they already have from a selection list, as opposed to having to remember or re-enter the data separately.
In this recipe, we'll create a basic interface that accesses our address book and pulls a contact's details, filling in our interface components—including some text fields and an image view—as we do so. Before you start, make sure that your device or emulator has some contacts available in it by choosing the Contacts icon on iPhone or the People icon on Android and adding at least one entry.
How to do it…
Open the
TiApp.xml
file...