我有一個地理編碼和它的作品的時候,我把一個經度和programically緯度但是當我試圖把從用戶位置的緯度和經度它強制關閉,這是我有調用經度和緯度到getFromLocation()?
public String address(){
Geocoder gc = new Geocoder(this);
List<Address> list = null;
try {
list = gc.getFromLocation(latt(),longg(),1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Address address = list.get(0);
StringBuffer str = new StringBuffer();
str.append("" + address.getLocality() + "\n");
str.append("" + address.getSubAdminArea() + "\n");
str.append("" + address.getAdminArea() + "\n");
str.append("" + address.getCountryName() + "\n");
str.append("" + address.getCountryCode() + "\n");
String strAddress = str.toString();
return strAddress;
}
public double latt(){
return LocationManagerHelper.getLatitude() ;
}
public double longg(){
return LocationManagerHelper.getLongitude();
}
logcat的
10-26 20:15:11.936: E/AndroidRuntime(28800): at http.www.hotapp.com.timeandlocation.TimeAndLocationActivity.address(TimeAndLocationActivity.java:95)
第95行是Address address = list.get(0);
關於我在做什麼的錯誤的任何建議?
後來問
我的想法是,緯度和經度的數字是長,當他們在被拉動。所以我的問題是,反正是有讓這個長和緯度來作爲一個更小的數字?當我編程的時候把它的長和短放在一個較短的數字latitude: 43.47389
Longitude:-114.34639
。當它從用戶位置拉時,我得到Latitude: 43.53400643333333
longitude: -114.32474341666666
。即使當我在編程中輸入較長的數字時,它仍然可以正常工作。
是什麼,你得到的錯誤?你可以從logcat得到這個。 – spatulamania
@spatulamania,我的壞我忘了發佈,我會把它放在 – Christian
什麼是用戶經緯度,日誌? – Reno