03-06-2009 05:55 PM
How to retrieve all phone numbers from contact book, when using PIMList we can only fetch 6 numbers, we dont get the mobile 2 & work 2 numbers.
is there any way to fetch them.
03-07-2009 11:10 AM
If you need to access the address book of balckberry then you need to use native PIM of blackberry. Use BlackBerryContact, BlackBerryContactGroup and BlackBerryContactList classes for this pourpose.
Press the kudos button to thank the user who helped you.
If your problem was get solved then please mark the thread as "Accepted solution".
03-10-2009 11:47 AM
Note that there is no “Mobile 2” phone number field in the BlackBerry address book, so I’ll assume you mean “Home 2”.
The “Home 2” and “Work 2” phone numbers of a Contact are values of the Contact.TEL field, just like all of a contact’s other phone numbers. They have the attributes BlackBerryContact.ATTR_HOME2 and BlackBerryContact.ATTR_WORK2, respectively. The following link has an example.
How To - Access Address Book contacts
Article Number: DB-00147
03-10-2009 11:53 AM
03-10-2009 12:08 PM
07-21-2010 11:40 AM
I have a 5.0 device here and there is a Mobile 2 field in the address book that users can enter. I assume this is a 5.0 development.
However, looking at the 5.0 API it doesn't look like MOBILE2 got defined, or anything got added to the BlackBerryContact definition. Users are complaining because the stuff they put in Mobile2 is invisible to our app.
What am I missing?
07-21-2010 11:45 AM - edited 07-21-2010 11:45 AM
edit: you are right, no MOBILE2, misread the question.
07-21-2010 09:15 PM
FWIW I figured out how to deal with this-- there is no new ATTR_ defined for mobile2 but the number is in there.
Counting the phones will return the right count:
int phoneCount = contact.countValues(BlackBerryContact.TEL);
Then as you loop through checking the attrs you will find two separate numbers have ATTR_MOBILE:
int curAttr = contact.getAttributes(BlackBerryContact.TEL, i);
It seems that the mobile2 number is later in the count, not sure if that's defined. If a user has mobile2 field defined but not mobile the number will just look like mobile.
The code in the RIM howto above (like my code, which prompted my search) is problematic, it seems to me-- it loops through and switches on the found attr, then just overwrites the target struct:
If you do that with mobile2 on board you'll silently hit that twice and lose one of the vals.