Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 445
Registered: ‎07-15-2008
My Device: Not Specified

Select number from Contacts

Hello,

how do I select a number from the list of Contacts? I have read that there is a way to pop up a lookup-screen where you can select a number from the whole contacts list. I have not found out how to do that.

Thank you in advance.

-javeC

If your question was answered, please accept it as a sollution and / or give Kudos ;-)
______________________________
Use the Search Field first! Maybe the question you want to ask already exists!
Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Select number from Contacts

Is it like you want to open the Address book from your application or is it like you want to read the number of a contact person selected.

 

Both are achevable,

To invoke address book

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800639/How_To_...

 

To read the contacts go thru the PIM API's.

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800363/How_To_...

 

If you are looking for something other than this please let us know.


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Select number from Contacts

i don't know of a way to directly select a number from the addressbook. i usually let the user select a contact and present a dialog showing all numbers (if there is more then one) to select from.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
New Developer
Posts: 11
Registered: ‎01-21-2009
My Device: Not Specified

Re: Select number from Contacts

For list all phone number for a contact you can follow this way:

 

case BlackBerryContact.TEL:
                                telVoxeaInter = blackBerryContact.getString(BlackBerryContact.TEL, 0);
                               
                                for (int atrCount = 0; atrCount < blackBerryContact.countValues(BlackBerryContact.TEL); ++atrCount)
                                {
                                    switch (blackBerryContact.getAttributes(BlackBerryContact.TEL,atrCount))
                                    {
                                        case BlackBerryContact.ATTR_WORK:
                                            ListTel[1][atrCount] = (blackBerryContact.getString(BlackBerryContact.TEL, atrCount));
                                            ListTel[0][atrCount] = "Work: ";                                             
                                            break;
                   
                                        case BlackBerryContact.ATTR_WORK2:
                                            ListTel[1][atrCount] = (blackBerryContact.getString(BlackBerryContact.TEL, atrCount));
                                            ListTel[0][atrCount] = "Work2: ";                                           
                                            break;
                   
                                        case BlackBerryContact.ATTR_HOME:
                                            ListTel[1][atrCount] = (blackBerryContact.getString(BlackBerryContact.TEL, atrCount));
                                            ListTel[0][atrCount] = "Home: ";                                           
                                            break;
                   
                                        case BlackBerryContact.ATTR_HOME2:
                                            ListTel[1][atrCount] = (blackBerryContact.getString(BlackBerryContact.TEL, atrCount));
                                            ListTel[0][atrCount] = "Home2: ";                                           
                                            break;
                   
                                        case BlackBerryContact.ATTR_MOBILE:
                                            ListTel[1][atrCount] = (blackBerryContact.getString(BlackBerryContact.TEL, atrCount));
                                            ListTel[0][atrCount] = "Mobile: ";                                           
                                            break;                   
                                    }
                                }

 

Here all phone for a contact are store in an object String[][] and then you can popup this information in a dialog box like this

 

int index = Dialog.ask("Tel:", (Object[])choice, 0);

 

I use this method in one of my project and that work properly, in my example all phone number aren't store check yourself in the switch case for other attribute like fax or pager.