Code example for Address

Methods: getExtras, setAddressLine, setCountryCode, setCountryName, setPostalCode

0
	public boolean isDelivered() { 
		return get(AddressVO.TAG_STATUS).equalsIgnoreCase("Delivered");
	} 
	 
	private void build() { 
		Bundle bundle = address.getExtras();
		StringBuilder line0 = new StringBuilder();
		String unit = address.getExtras().getString(TAG_UNIT);
		if(!unit.isEmpty()){
			line0.append(unit);
			line0.append("-");
		} 
		 
		line0.append(bundle.get(TAG_STR_NUM));
		 
		line0.append(" ");
 
		line0.append(bundle.get(TAG_STR_NAME));
		 
		line0.append(" ");
		 
		line0.append(bundle.get(TAG_STR_TYPE));
		 
		String direction = bundle.getString(TAG_STR_DIRECTION);
		 
		if(!direction.isEmpty()){
			line0.append(" ");
			line0.append(direction);
		} 
		 
		StringBuilder line1 = new StringBuilder();
		line1.append(bundle.get(TAG_CITY));
 
		line1.append(" ");
		 
		line1.append(bundle.get(TAG_PROV_CODE));
		 
		line1.append(" ");
		 
		line1.append(bundle.get(TAG_POSTAL_CD));
		 
		address.setAddressLine(0, line0.toString());
		address.setAddressLine(1, line1.toString());
		 
		/* 
		 * when values from json response text matches properties on  
		 * android.Location.Address class, set these values on the address 
		 * member variable of this class 
		 */ 
		address.setPostalCode(bundle.getString(TAG_POSTAL_CD));
		address.setCountryCode(Locale.CANADA.getCountry());
		address.setCountryName(Locale.CANADA.getDisplayCountry());
	} 
	 
	@Override 
	public String toString() {
		build();