I'd like to mark the location on Google Maps with an address. Can I get latitude hardness from the address using Google Maps API?
android google-geocoder google-maps
public GeoPoint getLocationFromAddress(String strAddress){
Geocoder coder = new Geocoder(this);
List<Address> address;
GeoPoint p1 = null;
try {
address = coder.getFromLocationName(strAddress,5);
if (address==null) {
return null;
}
Address location=address.get(0);
location.getLatitude();
location.getLongitude();
p1 = new GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));
return p1;
}
}
strAddress is a string containing an address The address variable stores the translated address.
© 2024 OneMinuteCode. All rights reserved.