0
ConnectionDetector cd = new ConnectionDetector(Healthcare.this);
isInternetPresent = cd.isConnectingToInternet();
if (isInternetPresent) {
GPSTracker gps = new GPSTracker(this);
Geocoder geoCoder = new Geocoder(Healthcare.this, Locale.getDefault());
if (gps.canGetLocation()) {
try {
latitudecur = gps.getLatitude();
longitudecur = gps.getLongitude();
Log.d("latlong",""+latitudecur+longitudecur);
List<Address> address = geoCoder.getFromLocation(latitudecur, longitudecur, 1);
Log.e("FInalAddress1",""+address.size());
## Heading ##
} catch (NullPointerException e) {
// TODO: handle exception
} catch (NumberFormatException e) {
// TODO: handle exception
} catch (IOException e) {
e.printStackTrace();
}
} else {
}
}
我在代碼中寫了上面的代碼,但在Log.e(「FInalAddress1」,「」+ address.size()); address.getsize()得到0.沒有得到像這樣的代碼,如地方,地址等 我的問題上面的代碼是什麼? 請幫助 感謝錯誤:無法從地址解析器獲取地址
它需要互聯網連接提供的API。你把互聯網許可證明了嗎? – lal
做了'latlong'打印值? – rafsanahmad007
是的,我把清單中的互聯網權限,並獲得經緯度 – Makvin