Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Contacts help

The docs have no info on how to actually use it, so I'm asking here.

Basically, I have a page where people, among other things, can enter an address (has to do with mapping).

I want to add a button that loads the contacts. and lets people alternatively choose one of their contacts addresses, and save it to a text box on the page.

— asked November 22nd 2010 by Josh Lewis
  • contacts

2 Answers

  • contacts seems to be a work in progress… here are my notes so far.
    1… contacts for ANDROID and iPHONE work with the continuous-1.4.2 build and NOT the 1.4.2 build. Apparently the 1.4.2 is really just a polished build. The Continuous build appears to be more advanced.
    iPHONE is supported. ANDROID seems to have some issues, but I have it working below.

    // This will return an unsorted array of all people.
    var people = Titanium.Contacts.getAllPeople();

    var makeTable2 = function() {

    for (var i = 0; i < people.length; i++) {
    temppeoplerow[i] = Ti.UI.createTableViewRow({

        //will try to sort the rows by last name
        function temppeopleSortByLastName(a, b) {
                var x = a.lname;

    // var x = a.lname.toLowerCase();
    var y = b.lname;
    // var y = b.lname.toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));

    //people =[];
    return temppeoplerow;

    }; //maketable2

    var tableview = Ti.UI.createTableView({
    }); //tableview maketable

    // the problem with this code is sorting. I can add a sort routine that works on emulator, but does nothing on the devices.
    if you can figure out how to get the sort to work on the devices, let me know please.

    — answered November 22nd 2010 by vincent youmans
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.