geocoder.getFromLocationName returns only null

I had a similar problem and found that polling the Geocoder until i got a result worked. Here is how i did it, so far works great. try { List<Address> geoResults = geocoder.getFromLocationName(“<address goes here>”, 1); while (geoResults.size()==0) { geoResults = geocoder.getFromLocationName(“<address goes here>”, 1); } if (geoResults.size()>0) { Address addr = geoResults.get(0); myLocation.setLatitude(addr.getLatitude()); myLocation.setLongitude(addr.getLongitude()); … Read more

How can I find the latitude and longitude from address?

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((double) (location.getLatitude() * 1E6), (double) (location.getLongitude() * 1E6)); return p1; } catch (IOException e) { e.printStackTrace(); … Read more