Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
redimedic
Posts: 30
Registered: 09-13-2011
My Carrier: Fido

BlackBerryContactGroup Problem

Hello,

 

Please help me.

 

Objective: Get all email address listed in a Contact group name "XYZ"

 

Env: BB JRE 6.0.0

 

Code:

bbContactList = (BlackBerryContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY);
Enumeration allGroups = bbContactList.items(BlackBerryContactList.SEARCH_GROUPS);
_vbbGroups = enumToVector(allGroups);

 

BlackBerryContactGroup bbSelectedGroup = (BlackBerryContactGroup)_vbbGroups.elementAt(0);

System.out.println(" Number of contact in group " + bbSelectedGroup.getString(BlackBerryContactGroup.NAME, PIMItem.ATTR_NONE) + " are " + bbSelectedGroup.numContacts());

//Output says 5 contacts in group named WORK

 

int atrCount=0;
String emailAddr;
String phoneNo;

for(i=0; i < bbSelectedGroup.countValues(BlackBerryContactGroup.ADDRESS_TYPE_EMAIL); i++){
emailAddr = bbSelectedGroup.getString(BlackBerryContactGroup.ADDRESS_TYPE_EMAIL, i);
System.out.println( " %%%%%% " + emailAddr );
}

//Output - Crash

ContactGroupImpl.countValues(int) line: 88
ContactScreen.getContactList() line: 180 ->This line refer to for loop statement

 

I tried to get number of contacts which are of type email address.Becz out of 5 contact added in group 2 are telephone and three are email address.

 

Please provide an idea what is happening wrong?

 

 

 

 

 

Please use plain text.