I have a problem that drives me crazy and I need some support.
I want to create an application that create an addresses list from a string that contains the location description, and I have the following code:
Geocoder fwdGeoGeocoder = new Geocoder(this, Locale.US);
String streetAdress = "160 Riverside Drive, New York, New York";
List<Address> locations = null;
try
{
locations = fwdGeoGeocoder.getFromLocationName(streetAdress, 10);
}
catch (IOException ex)
{
ex.printStackTrace();
}
myTopTextView.setText("Your current location is: Lat: "+locations.get(0).getLatitude()+
" Long: "+locations.get(0).getLongitude());
But locations is a void array after getFromLocationName is called and I don’t know why. I tested this on my emulator that runs an android API lvl 7.
Can somebody help me?
The target AVD has to support Google APIs and be able to access internet:
<uses-permission android:name="android.permission.INTERNET"/>