안드로이드 개발 질문/답변
(글 수 45,052)
int location1 = map1.GetLocations(0);
int location2 = map1.GetLocations(1);
이런식으로 다른 클래스에서 map1.java 에 있는 메소드에 0과 1을 보내주면
위도와 경도 값을 가져오게 만들어 놨습니다
그런데 런타임 오류가 걸리네요
이유는 대충 알거 같은데
gps로 위도 경도 가져오는 경우 쓰레드 형식으로 만들어줘서 해줘야 하나요
map1.java에 LocationLitsner 가 있습니다.
아래 소스는 해당 메소드 입니다
가르쳐 주세요 ㅠ
public int GetLocations(int kk){
if (myLocation != null) {
latPoint = myLocation.getLatitude();
lngPoint = myLocation.getLongitude();
lat = Double.valueOf(latPoint*1E6).intValue();
lon = Double.valueOf(lngPoint*1E6).intValue();
if(kk == 1)
return lon;
}
if(kk == 0)
return lat;
return 0;
}
int location2 = map1.GetLocations(1);
이런식으로 다른 클래스에서 map1.java 에 있는 메소드에 0과 1을 보내주면
위도와 경도 값을 가져오게 만들어 놨습니다
그런데 런타임 오류가 걸리네요
이유는 대충 알거 같은데
gps로 위도 경도 가져오는 경우 쓰레드 형식으로 만들어줘서 해줘야 하나요
map1.java에 LocationLitsner 가 있습니다.
아래 소스는 해당 메소드 입니다
가르쳐 주세요 ㅠ
public int GetLocations(int kk){
if (myLocation != null) {
latPoint = myLocation.getLatitude();
lngPoint = myLocation.getLongitude();
lat = Double.valueOf(latPoint*1E6).intValue();
lon = Double.valueOf(lngPoint*1E6).intValue();
if(kk == 1)
return lon;
}
if(kk == 0)
return lat;
return 0;
}