마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 구글맵 gps 질문합니다.

0 추천
gps를 키면 현재 저의 위치(건물)가 나오는데

제가 구현하고싶은게 그 건물을 터치하게되면 다른 액티비티로 넘어가게 하고싶습니다

꼭 현재 위치에서만 터치 될필요는 없구여

특정건물에 터치를 할수잇게 하여 건물 내부 지도가 나오게하는걸 구현하고싶습니다

그냥 레이아웃에 버튼 생성해서 다른 액티비티로 넘어가는건 할수있는데

특정 건물 위치를 터치할수잇게 하는 방법을 모르겠습니다.
카릴리 (470 포인트) 님이 2015년 5월 6일 질문

1개의 답변

0 추천

구글맵에 onMapClickListener를 달아서 체크하시면 됩니다.

public final void setOnMapClickListener (GoogleMap.OnMapClickListener listener)

 

Sets a callback that's invoked when the map is tapped.

Parameters
listener The callback that's invoked when the map is tapped. To unset the callback, use null.

public abstract void onMapClick (LatLng point)

 

Called when the user makes a tap gesture on the map, but only if none of the overlays of the map handled the gesture. Implementations of this method are always invoked on the main thread.

Parameters
point The point on the ground (projected from the screen point) that was tapped.

 

클릭하면 위/경도 값이 인자로 넘어오는데 이 값을 이용해서 특정 건물의 좌표와 비교해서 로직을 처리하면 됩니다.

Gradler (109,780 포인트) 님이 2015년 5월 6일 답변
...