getContactData Method

This command gets a specific contact object based on contact ID from the local copy of the contact list generated by getContacts

contactObj = intel.xdk.contacts.getContactData(contactID);

Description:

This method returns a specific contact object based on contact ID from the local copy of the contact list obtained the last time the getContacts method was called. See the getContacts method for more information. Each contact object has the following attributes: id, first, last, name (an array of names), phones (an array of phone numbers), emails (an array of email addresses), addresses (an array of addresses in the following format: { street:'%@', city:'%@', state:'%@', zip:'%@', country:'%@' })

Available Platforms:

Parameters:

  • contactID: The contact ID to retrieve info for

Returns:

  • contactObj: This method returns a single contact object

Example:


function contactsReceived() {
        var table = document.getElementById("contacts");
        table.innerHTML = '';

        var myContacts = intel.xdk.contacts.getContactList();

        for(var i=0;i<myContacts.length;i++) {
                //add row to table
                var contactInfo = intel.xdk.contacts.getContactData(myContacts[i]);
                var tr = document.createElement("tr");
                tr.setAttribute('id', 'pnid'+contactInfo.id);
                tr.setAttribute('onClick', 'document.getElementById("iden").value = '+contactInfo.id+';');
                tr.setAttribute('style', 'background-color:#B8BFD8');
                var id = document.createElement("td");
                id.innerHTML = contactInfo.id;
                tr.appendChild(id);
                var msg = document.createElement("td");
                msg.innerHTML = contactInfo.name;
                tr.appendChild(msg);
                table.appendChild(tr);
        }
}
            
Para obter informações mais completas sobre otimizações do compilador, consulte nosso aviso de otimização.