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
trainee
Posts: 237
Registered: ‎05-07-2010
My Device: 8520

How to get email address from contacts?

hi

 

I just want to know that how we can get all email ids from  contacts that we have saved before?

___________________________________________________
please press kudos(star button on left) if this post is helpful to you
"Accept as solution" if your query has been resolved.@hitendra
_________________________________________________
Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: How to get email address from contacts?

This Link will be helpfull for u.

 

http://supportforums.blackberry.com/t5/Java-Development/Access-Address-Book-contacts/ta-p/445045

------------------------------------------------------------------------------------

Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.

Please use plain text.
Developer
michaelk1
Posts: 172
Registered: ‎04-19-2010
My Device: Bold 9700

Re: How to get email address from contacts?

Hi trainee,

 

this code is working fine for me:

 

 

   	HelpString1 = "";
    	PIM pim = PIM.getInstance();
    	ContactList contacts;
			contacts = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY);

	Enumeration items;
	items = contacts.items();
	while(items.hasMoreElements())
	{
	 Contact contact = (Contact) items.nextElement();

	 if (contacts.isSupportedField(contact.EMAIL)) 
	  {
	   if (contact.countValues(contact.EMAIL) > 0) {
		String nname = contact.getString(contact.EMAIL, 0);
		HelpString1 = "";
	   }
        }
	}

 

Hoping it will help.

 

cu

michael

 

 

cu
michael
--------------------------------------------------------------------------------------------------------------------------
please give kudos to thank everyone who helped you or put you in the right direction.
please mark the thread as solved, if you found your solution.
Please use plain text.
Developer
trainee
Posts: 237
Registered: ‎05-07-2010
My Device: 8520

Re: How to get email address from contacts?

thankx nitin and michaelk1.

 

I have already got the solution.

___________________________________________________
please press kudos(star button on left) if this post is helpful to you
"Accept as solution" if your query has been resolved.@hitendra
_________________________________________________
Please use plain text.