Address setAdminArea - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Address setAdminArea method.

This code example shows how to use the following methods:setAddressLine, setAdminArea, setCountryCode, setLocality, setPostalCode
        this.lastLongitude = longitude;
        if (shouldSimulateGeocodeException) {
            throw new IOException("Simulated geocode exception");
        } 
        Address address = makeAddress();
        address.setAddressLine(0, addressLine1);
        address.setLocality(city);
        address.setAdminArea(state);
        address.setPostalCode(zip);
        address.setCountryCode(countryCode);
        return oneElementList(address);
    } 
 
    @Implementation 
    public List<Address> getFromLocationName(String locationName, int maxResults) throws IOException {
        didResolution = true;
        this.lastLocationName = locationName;
        if (shouldSimulateGeocodeException) {
            throw new IOException("Simulated geocode exception");
        } 

9
CodeRank
This code example shows how to use the following methods:setAddressLine, setAdminArea, setCountryCode, setLocality, setPostalCode
        this.lastLatitude = latitude;
        this.lastLongitude = longitude;
        if (shouldSimulateGeocodeException) {
            throw new IOException("Simulated geocode exception");
        } 
        Address address = new Address(Locale.getDefault());
        address.setAddressLine(0, addressLine1);
        address.setLocality(city);
        address.setAdminArea(state);
        address.setPostalCode(zip);
        address.setCountryCode(countryCode);
        return oneElementList(address);
    } 
 
    @Implementation 
    public List<Address> getFromLocationName(String locationName, int maxResults) throws IOException {
        this.lastLocationName = locationName;
        if (shouldSimulateGeocodeException) {
            throw new IOException("Simulated geocode exception");
        } 
8
CodeRank
This code example shows how to use the following methods:setAdminArea, setFeatureName, setLatitude, setLocality, setLongitude
         * sub admin area 
         * locality 
         * thoroughfare 
         * feature name 
         */ 
        final Address a = new Address(Locale.getDefault());
 
        a.setLongitude(in.readDouble());
        a.setLatitude(in.readDouble());
        final String admin = in.readUTF();
        final String subAdmin = in.readUTF();
        final String locality = in.readUTF();
        final String thoroughfare = in.readUTF();
        final String feature = in.readUTF();
 
        if (admin.length() > 0)
            a.setAdminArea(admin);
        if (subAdmin.length() > 0)
            a.setSubAdminArea(subAdmin);
        if (locality.length() > 0)

5
CodeRank
This code example shows how to use the following methods:setAddressLine, setAdminArea, setExtras, setFeatureName, setLatitude
				Log.e(TAG, "Geocoder API response status not ok -- status=" + status);
				throw new RoutyException("There was a problem understanding an address."); 
			} else {  
				// TODO status is ok - parse the XML into an Address object 
				int lineNumber = 0;
				Address result = new Address(Locale.getDefault());
				 
				expr = "/GeocodeResponse/result";
				NodeList results = (NodeList) xpath.evaluate(expr, root, XPathConstants.NODESET);
				if (results.getLength() == 0) {
					return null; 
				} 
				 
				// GET THE PLACE NAME (ESTABLISHMENT) IF THERE IS ONE (EX. "UNIVERSITY OF TEXAS") 
				expr = "/GeocodeResponse/result[1]/address_component[type=\"establishment\"]/long_name";
				String establishment = (String) xpath.evaluate(expr, root, XPathConstants.STRING);
				result.setFeatureName(establishment);
//				Log.v(TAG, "establishment=" + establishment); 
				 
				// GET THE STREET NUMBER AND NAME 

5
CodeRank
This code example shows how to use the following methods:setAdminArea
	/** 
	 * @param adminArea 
	 * @see android.location.Address#setAdminArea(java.lang.String) 
	 */ 
	public void setAdminArea(String adminArea) {
		delegate.setAdminArea(adminArea);
	} 
 
	/** 
	 * @param countryCode 
	 * @see android.location.Address#setCountryCode(java.lang.String) 
	 */ 
	public void setCountryCode(String countryCode) {
		delegate.setCountryCode(countryCode);
	} 
 
	/** 
	 * @param countryName 
	 * @see android.location.Address#setCountryName(java.lang.String) 
	 */ 
3
CodeRank
This code example shows how to use the following methods:setAddressLine, setAdminArea, setCountryCode, setCountryName, setLatitude
 
        assertEquals("2381-2397 Massachusetts Ave, Cambridge", AddressUtils.addressToName(a));
    } 
 
    private Address getFullGeocoded() {
        final Address a = new Address(Locale.US);
 
        a.setAddressLine(0, "2381-2397 Massachusetts Ave");
        a.setAddressLine(1, "Cambridge, MA 02140");
        a.setAddressLine(2, "USA");
        a.setAdminArea("Massachusetts");
        a.setLocality("Cambridge");
        a.setThoroughfare("Massachusetts Ave");
        a.setPostalCode("02140");
        a.setCountryCode("US");
        a.setCountryName("United States");
        a.setLatitude(42.3969102);
        a.setLongitude(-71.1296033);
 
        return a;

3
CodeRank

Related Address setAdminArea Questions & Answers:

setAdminArea Method Overview
Sets the administrative area name of the address to the given String, which may be null
See Code Examples for other Android Address Methods: