1

When the user clicks a button in my app, I want to open the contact list for the user to select a contact. I then want to get the phone number for the selected contact.

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
Aswan
  • 5,085
  • 10
  • 46
  • 70

1 Answers1

0

you can use BlackBerryContactList.choose().

BlackBerryContactList list = (BlackBerryContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY);
        PIMItem contact = list.choose();
        if(contact != null){
            String mobileNumber="";
            for(int i=0; i < contact.countValues(Contact.TEL); i++)
            {
                if(contact.getAttributes(Contact.TEL, i) == Contact.ATTR_MOBILE)
                    mobileNumber = contact.getString(Contact.TEL, i);  
            }
        }
Vivart
  • 14,900
  • 6
  • 36
  • 74
  • Thankq vivart.but i need to get mobile number from selected contact – Aswan Dec 14 '10 at 07:30
  • vivart.i need to get phone number from selected contact from contact list i execute this code.when i select mobile number it is directly making call.for my app i need to send sms to selected contact programetically – Aswan Dec 14 '10 at 09:00
  • the code is not working. when i click a contact, its didnt displaying anything. – Rince Thomas Jan 19 '12 at 13:48