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:
Code:
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.