View Single Post
Old 07-30-2008, 05:54 AM   #4 (permalink)
Thumbs Must Hurt
baran_khan's Avatar
Join Date: Apr 2008
Model: 9500
Carrier: Airtel
Posts: 110
Post Thanks: 0
Thanked 0 Times in 0 Posts

Originally Posted by PaoloLim View Post
The attribute constant isn't the same as the index number. I'm assuming you're getting an arrayindexoutofbounds exception or nullreference exception. Best way I can think of is to do something like:

for(int y=0; y < contact.countValues(Contact.TEL); y++)
    if(contact.getAttributes(Contact.TEL, y) == Contact.ATTR_MOBILE)
        phone = contact.getString(Contact.TEL, y);  
The reason the fax attribute constant is working is that it happens to be low enough to be an actual index.

EDIT: Sorry, that's a lowercase c on contact.getAttributes.

Sorry for not replying you this long...was on holiday...u know what it actually works...but I am not really satisfied with the way they are dealing with this....instead of doing it this way..they should have maintained the index names associated with the values that are being stored...instead of having it changed every time we make a change in the contacts...but I guess this is for saving the memory...

Thanks for ur support..i ll look forward for such responses and hope we can share a bag full of knowledge in future.....
Smart People ask for Help!!!
Offline   Reply With Quote