private void updateWithNewLocation(Location location) {
// TODO Auto-generated method stub
String latLongString = new String();
TextView mylocationText = new TextView(this);
mylocationText = (TextView)findViewById(R.id.myText);
String addressString = "위치를 찾을 수 없음!";
if(location != null) {
double lat = location.getLatitude();
double lng = location.getLongitude();
latLongString = "위도 : " + lat + "\n경도 : " + lng;
Geocoder gc = new Geocoder(this, Locale.getDefault());
try {
List<Address> addresses = gc.getFromLocation(lat, lng, 1);
StringBuilder sb = new StringBuilder();
if(addresses != null && addresses.size() > 0) {
Address address = addresses.get(0);
sb.append(address.getCountryName()).append("/");
sb.append(address.getLocality()).append("/");
sb.append(address.getThoroughfare()).append("/");
sb.append(address.getFeatureName()).append("/");
}
addressString = sb.toString();
} catch(IOException e) {}
} else {
latLongString = "위치를 찾을 수 없음";
}
mylocationText.setText("당신의현재 위치는 : \n" + latLongString + "\n" + addressString);
}
이렇게 코드를 짯는데 계속 좌표와 위도 그리고 주소는 "위치를 찾을 수 없음!";
이것만 뜨네요 어디가 잘못 된걸까요....ㅠ.ㅠ 무슨 오픈api라도 깔아야되는건가요????




location값이 null인지 확인해 보세요.
아예 if문 안으로 못들어가는거 같은데요.