String add = obj.getAddressLine(0); GUIStatics.currentAddress = obj.getSubAdminArea() + "," + obj.getAdminArea(); GUIStatics.latitude = obj.getLatitude(); GUIStatics.longitude = obj.getLongitude(); GUIStatics.currentCity= obj.getSubAdminArea(); GUIStatics.currentState= obj.getAdminArea(); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea();
String add = obj.getAddressLine(0); GUIStatics.currentAddress = obj.getSubAdminArea() + "," + obj.getAdminArea(); GUIStatics.latitude = obj.getLatitude(); GUIStatics.longitude = obj.getLongitude(); GUIStatics.currentCity= obj.getSubAdminArea(); GUIStatics.currentState= obj.getAdminArea(); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea();
public Address getAddressFromLocation(double latitude, double longitude){ String zipcode=""; Address address=null; try { Geocoder geocoder = new Geocoder(mContext, Locale.getDefault()); List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1); if (addresses.size() > 0) { address= addresses.get(0); String admin = address.getAdminArea(); String subLocality = address.getSubLocality(); String city = address.getLocality(); zipcode = address.getPostalCode(); } } catch (IOException e) { e.printStackTrace(); mAppUtil.showToast("Please try again"); } return address; }
import android.location.Address; import android.support.annotation.NonNull; import android.text.TextUtils; import com.google.i18n.addressinput.common.AddressData; import com.google.i18n.addressinput.common.FormOptions; import com.google.i18n.addressinput.common.FormatInterpreter; ... public static String getFormattedAddress(@NonNull final Address address, @NonNull final String regionCode) { final FormatInterpreter formatInterpreter = new FormatInterpreter(new FormOptions().createSnapshot()); final AddressData addressData = (new AddressData.Builder() .setAddress(address.getThoroughfare()) .setLocality(address.getLocality()) .setAdminArea(address.getAdminArea()) .setPostalCode(address.getPostalCode()) .setCountry(regionCode) // REQUIRED .build()); // Fetch the address lines using getEnvelopeAddress, List<String> addressFragments = formatInterpreter.getEnvelopeAddress(addressData); // join them, and send them to the thread. return TextUtils.join(System.getProperty("line.separator"), addressFragments); }
import android.location.Address; import android.support.annotation.NonNull; import android.text.TextUtils; import com.google.i18n.addressinput.common.AddressData; import com.google.i18n.addressinput.common.FormOptions; import com.google.i18n.addressinput.common.FormatInterpreter; ... public static String getFormattedAddress(@NonNull final Address address, @NonNull final String regionCode) { final FormatInterpreter formatInterpreter = new FormatInterpreter(new FormOptions().createSnapshot()); final AddressData addressData = (new AddressData.Builder() .setAddress(address.getThoroughfare()) .setLocality(address.getLocality()) .setAdminArea(address.getAdminArea()) .setPostalCode(address.getPostalCode()) .setCountry(regionCode) // REQUIRED .build()); // Fetch the address lines using getEnvelopeAddress, List<String> addressFragments = formatInterpreter.getEnvelopeAddress(addressData); // join them, and send them to the thread. return TextUtils.join(System.getProperty("line.separator"), addressFragments); }
area = addressLocation.getSubLocality(); city = addressLocation.getLocality(); state = addressLocation.getAdminArea(); countryCode = addressLocation.getCountryCode(); postalCode = addressLocation.getPostalCode();
String add = obj.getAddressLine(0); GUIStatics.currentAddress = obj.getSubAdminArea() + "," + obj.getAdminArea(); GUIStatics.latitude = obj.getLatitude(); GUIStatics.longitude = obj.getLongitude(); GUIStatics.currentCity= obj.getSubAdminArea(); GUIStatics.currentState= obj.getAdminArea(); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea();
String add = obj.getAddressLine(0); GUIStatics.currentAddress = obj.getSubAdminArea() + "," + obj.getAdminArea(); GUIStatics.latitude = obj.getLatitude(); GUIStatics.longitude = obj.getLongitude(); GUIStatics.currentCity= obj.getSubAdminArea(); GUIStatics.currentState= obj.getAdminArea(); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea();
String add = obj.getAddressLine(0); String currentAddress = obj.getSubAdminArea() + "," + obj.getAdminArea(); double latitude = obj.getLatitude(); double longitude = obj.getLongitude(); String currentCity= obj.getSubAdminArea(); String currentState= obj.getAdminArea(); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea(); System.out.println("obj.getAdminArea()"+obj.getAdminArea()); System.out.println("obj.getPostalCode()"+obj.getPostalCode()); System.out.println("obj.getSubAdminArea()"+obj.getSubAdminArea());
public String getAddress(Context context, double lat, double lng) { Geocoder geocoder = new Geocoder(context, Locale.getDefault()); try { List<Address> addresses = geocoder.getFromLocation(lat, lng, 1); Address obj = addresses.get(0); String add = obj.getAddressLine(0); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea(); add = add + "\n" + obj.getLocality(); add = add + "\n" + obj.getSubThoroughfare(); return add; } catch (IOException e) { e.printStackTrace(); Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); return null; } }
if (obj.getPostalCode() != null) add = add + " - " + obj.getPostalCode(); if (obj.getAdminArea() != null) add = add + "\n" + obj.getAdminArea(); if (obj.getCountryName() != null) add = add + "\n" + obj.getCountryName();
String add = obj.getAddressLine(0); GUIStatics.currentAddress = obj.getSubAdminArea() + "," + obj.getAdminArea(); GUIStatics.latitude = obj.getLatitude(); GUIStatics.longitude = obj.getLongitude(); GUIStatics.currentCity= obj.getSubAdminArea(); GUIStatics.currentState= obj.getAdminArea(); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea();
public String getAddress(double lat, double lng) { Geocoder geocoder = new Geocoder(MapsActivity.this, Locale.getDefault()); String Address=" "; Log.e("ADDRESS","ADDRESS"); try { List<Address> addresses = geocoder.getFromLocation(lat, lng, 1); Address obj = addresses.get(0); String add = obj.getAddressLine(0); Address= obj.getAddressLine(0); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea(); add = add + "\n" + obj.getLocality(); add = add + "\n" + obj.getSubThoroughfare(); Log.e("IGA", "Address" + add); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); } return Address; }
String add = obj.getAddressLine(0); GUIStatics.currentAddress = obj.getSubAdminArea() + "," + obj.getAdminArea(); GUIStatics.latitude = obj.getLatitude(); GUIStatics.longitude = obj.getLongitude(); GUIStatics.currentCity= obj.getSubAdminArea(); GUIStatics.currentState= obj.getAdminArea(); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea();
Address address = addresses.get(0); String state, city, zip, street; if (address.getAdminArea() != null) { state = address.getAdminArea(); } else { state = "";
.getFromLocation(latitude, longitude, 1); for (Address addrss : listAddresses) { String adminArea = addrss.getAdminArea(); Logging(SHOW_LOG, TAG, "adminArea = " + adminArea);
sb.append(address.getAdminArea()).append("\n"); //state
String add = obj.getAddressLine(0); GUIStatics.currentAddress = obj.getSubAdminArea() + "," + obj.getAdminArea(); GUIStatics.latitude = obj.getLatitude(); GUIStatics.longitude = obj.getLongitude(); GUIStatics.currentCity= obj.getSubAdminArea(); GUIStatics.currentState= obj.getAdminArea(); add = add + "\n" + obj.getCountryName(); add = add + "\n" + obj.getCountryCode(); add = add + "\n" + obj.getAdminArea(); add = add + "\n" + obj.getPostalCode(); add = add + "\n" + obj.getSubAdminArea();
add = add + "\nCountryName " + obj.getCountryName(); add = add + "\nCountryCode " + obj.getCountryCode(); add = add + "\nAdminArea " + obj.getAdminArea(); add = add + "\nPostalCode " + obj.getPostalCode(); add = add + "\nSubAdminArea " + obj.getSubAdminArea();
List<Address> addresses; Geocoder geocoder = new Geocoder(getActivity()); addresses = geocoder.getFromLocation(latitude, longitude, 10); if (addresses == null || addresses.isEmpty()) addresses = MyGeocoder.getFromLocation(latitud, longitud, 10); //Mygeocoder is a class with a http request to google server, that replaces Geocoder, if not work HashMap itemAddress; ArrayList itemList = new ArrayList<HashMap<String, String>>(); Log.d("Addresses", "" + "Start to print the ArrayList"); for (int i = 0; i < addresses.size(); i++) { itemAddress = new HashMap<String, String>(); Address address = addresses.get(i); String addressline = "Addresses from getAddressLine(): "; for (int n = 0; n <= address.getMaxAddressLineIndex(); n++) { addressline += " index n: " + n + ": " + address.getAddressLine(n) + ", "; } Log.d ("Addresses: ", addressline); Log.d("Addresses getAdminArea()", "" + address.getAdminArea()); Log.d("Addresses getCountryCode()", "" + address.getCountryCode()); Log.d("Addresses getCountryName()", "" + address.getCountryName()); Log.d("Addresses getFeatureName()", "" + address.getFeatureName()); Log.d("Addresses getLocality()", "" + address.getLocality()); Log.d("Addresses getPostalCode()", "" + address.getPostalCode()); Log.d("Addresses getPremises()", "" + address.getPremises()); Log.d("Addresses getSubAdminArea()", "" + address.getSubAdminArea()); Log.d("Addresses getSubLocality()", "" + address.getSubLocality()); Log.d("Addresses getSubThoroughfare()", "" + address.getSubThoroughfare()); Log.d("Addresses getThoroughfare()", "" + address.getThoroughfare()); }