0
다음 코드를 사용하여 myFrame (Google Maps API V2)을 autoCompleteFragment (Google Places API)에서 선택한 위치로 업데이트하려고했지만 마커는 잘 바뀌지 만 카메라는 켜져 있습니다. 이전 위치.onPlaceSelected() 후 moveCamera가 작동하지 않습니다
PlaceAutocompleteFragment autocompleteFragment=(PlaceAutocompleteFragment)getFragmentManager().findFragmentById(R.id.autoComplete);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
LatLng autoCompleteLatLng=place.getLatLng();
Location newLoc=new Location("New");
newLoc.setLatitude(autoCompleteLatLng.latitude);
newLoc.setLongitude(autoCompleteLatLng.longitude);
onLocationChanged(newLoc);
}
private void handleNewLocation(Location location){
double currentLatitude = location.getLatitude();
double currentLongitude = location.getLongitude();
LatLng latLng = new LatLng(currentLatitude, currentLongitude);
MarkerOptions options = new MarkerOptions()
.position(latLng)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
map.addMarker(options);
map.moveCamera(CameraUpdateFactory.newLatLng(latLng));
map.animateCamera(CameraUpdateFactory.zoomTo(10.0f));
}
@Override
public void onLocationChanged(Location location){
handleNewLocation(location);
}
내가 그 시도를하지만 여전히 작동하지 않습니다. 내가 디버그를 위해 som 로그를 두었고 bot에 정확한 lat와 long이 있지만 카메라를 업데이트하지는 않습니다. –