The MAFAddressFormatter formats phone numbers and addresses, and translates the names of the address fields.
private MAFAddressFormatter formatter = null; formatter = MAFAddressFormatter.getInstance(this); formatter.initWithSAPXML();
<!-- United States --> <format country="us"> <addresses> <address format="HOUSE_NO STREET\nLOCATION\nCITY REGION POSTL_COD1\nCOUNTRY" /> </addresses> <addressfields> <line> <field id="HOUSE_NO" keyboard="NUMERIC" width="35%" label="{No.}" /> <field id="STREET" width="65%" label="{STREET}" /> </line> <line> <field id="LOCATION" label="{STREET} 4" /> </line> <line> <field id="CITY" label="{CITY}" /> <field id="REGION" keyboard="ALLCAPS" label="{State}" /> </line> <line> <field id="POSTL_COD1" keyboard="NUMERIC" label="{ZIP}" /> <field id="COUNTRY" label="{COUNTRY}" /> </line> </addressfields> <phonenumbers internationalprefix="1" outboundcode="011"> <phonenumber format="(xxx) xxx-xxxx" /> <phonenumber format="(415) xxx-xxxx" /> <phonenumber format="(xxx) xxx-xx8x" /> </phonenumbers> </format>
InputStream iStream = activity.getResources().openRawResource( R.raw.countryformats_patch); formatter.initWithCustomXML(iStream);For the method details of the MAFAdressFormatter, see its API documentation.