0
我有一個問題,讓我發瘋,我需要一些支持。 我想創建創建包含位置描述字符串的地址列表中的應用程序,我有以下代碼:在android中的getFromLocationName問題
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());
但位置是getFromLocationName後空數組被稱爲,我不知道爲什麼。我在運行android API lvl 7的模擬器上測試了這一點。 有人能幫助我嗎?
嗯,工作對我來說:40.791192,-73.9790589你有沒有試圖去通過你的代碼調試器? – iDroid
是的,位置仍然無效。可能是因爲AVD設置? – Arkde
目標AVD必須支持Google API並能夠訪問互聯網: –
iDroid