я пытался что-то вроде нижеПочему возвращаемое значение getCurrentLattitude() вызывает исключение в числовом формате?
double latitude = 0;
double longitude = 0;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.places_details_gridview);
locManager = (LocationManager) getSystemService(LOCATION_SERVICE);
currentLoc = new CurrentLocation(locManager, ShowPlacesInList.this);
if(currentLoc.getCurrentLattitude() != null && currentLoc.getCurrentLongitude() != null){
latitude = Double.parseDouble(currentLoc.getCurrentLattitude());
longitude = Double.parseDouble(currentLoc.getCurrentLongitude());
myLoc = new Location("");
myLoc.setLatitude(latitude);
myLoc.setLongitude(longitude);
calculateDist();
}
}
Это показывает исключение формат чисел в
latitude = Double.parseDouble(currentLoc.getCurrentLattitude());
из currentLoc.getLatitude и currentloc.getLongitude я получаю значение строки
Какое значение возвращается, которое невозможно разобрать? –
проверить значение currentLoc.getCurrentLattitude() .. вы получите ответ – stinepike
Строковое значение, которое вы переходите к Double.parseDouble(), не в правильном формате. Распечатайте его в logcat и разместите здесь. – Melquiades