Titanium Community Questions & Answer Archive

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

contact.sort on android

THis code works fine on iPHONE, but a.lastname is returning NULL on an ANDROID. So, I believe the problem is when the array is passed to the function.. any suggestions?

//    var people = Titanium.Contacts.getAllPeople();
if (Ti.Platform.name == "android"){
    Ti.API.info('--------  entering ANDROID vyinclude.js include file ----------');
    function sortByFirstName(a, b) {
        //var x = a.firstName.toLowerCase();
        //var y = b.firstName.toLowerCase();
        var x = a.lastName.toLowerCase();
        var y = b.lastName.toLowerCase();
        //var x = a.lastName;
        //var y = b.lastName;
        Ti.API.info('x = ' + x);  //x and y are returning null.. so the sort is not working.
        Ti.API.info('y = ' + y);
        return ((x < y) ? -1 : ((x > y) ? 1 : 0));
    Ti.API.info('--------  exitiing ANDROID vyinclude.js include file ----------');

— asked November 4th 2010 by vincent youmans
  • contact
  • sort

0 Answers

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.