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

Native Development

Reply
Contributor
vikbadu
Posts: 13
Registered: ‎04-14-2011
My Device: playbook,SmartPhones
My Carrier: Flex,Blackberry JDE

How to split work address and home address in contacts api?

I am developing a small application, which gets postal addresses from the device. I used the following code, but i could not split the home and work address.....whats the problem with this code, can u tell me friends....

 

const QList<ContactPostalAddress> postalAddresses = contact.postalAddresses();
	 QString PA="";QString PAC="";QString PAS="";QString PACO="";QString PCODE="";
	 QString WPA="";QString WPAC="";QString WPAS="";QString WPACO="";QString WPCODE="";
	 if (!postalAddresses.isEmpty())
	 {
	 		 	 foreach (const ContactPostalAddress &postAttribute, postalAddresses)
	 		 	 {
	 		 	        if (postAttribute.subKind() ==  AttributeSubKind::Home)
	 		 	        {
	 		 	        	PA=postAttribute.line1() + postAttribute.line2();
	 		 	        	PAC=postAttribute.city();
	 		 	        	PAS=postAttribute.region();
	 		 	        	PACO=postAttribute.country();
	 		 	        	PCODE=postAttribute.postalCode();
	 		 	        }
	 		 	        if (postAttribute.subKind() == AttributeSubKind::Work)
	 		 	      	{
	 		 	      	 	WPA=postAttribute.line1() + postAttribute.line2();
	 		 	      	 	WPAC=postAttribute.city();
	 		 	      	 	WPAS=postAttribute.region();
	 		 	      	 	WPACO=postAttribute.country();
	 		 	      	 	WPCODE=postAttribute.postalCode();
	 		 	      	}
	 		 	 }
	 }

 

 if (postAttribute.subKind() ==  AttributeSubKind::Home)

   If i give the condition like this,it does not work, otherwise it works fine....

Please use plain text.