아래 코드의 토스트 메시지가 표시되지 않는 것 같습니다. 이유를 확인할 수 없습니다. 내가 놓친 오류가 있습니까? 토스트로 GPS 위치가 표시되지 않습니다.
MyCurrentLocation
public class MyLocationListener implements LocationListener{
Geocoder gc = new Geocoder(MyCurrentLocation.this.getApplicationContext(), Locale.getDefault());
public void onLocationChanged(Location loc){
try{
loc.getLatitude();
loc.getLongitude();
List <Address> addr = gc.getFromLocation(loc.getLatitude(),loc.getLongitude(),1);
String results = "";
if (addr.size() > 0){
results += addr.get(0).getCountryName();
}
Toast.makeText(getApplicationContext(),results,Toast.LENGTH_LONG).show();
} catch(Exception e){
}
있어 권한을? –
에뮬레이터에서 작동하지 않았습니다. Device에서 작동합니다. 기기에서 테스트 해 보시겠습니까? – Abhilasha
GPS 정보를 Logcat에 게시 해 보셨습니까? – thegrinner