I have integrated google map into my application.
Listener methods onCameraIdle() and onCameraIdle() functions are getting called continuously how to stop that?
Below is my fragment code:
class AddAddressFragment : Fragment(), View.OnClickListener, OnMapReadyCallback,
GoogleMap.OnCameraIdleListener, GoogleMap.OnCameraMoveListener {
private var mGoogleMap: GoogleMap? = null
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mapView?.getMapAsync(this)
}
override fun onMapReady(p0: GoogleMap?) {
mGoogleMap = p0
with(mGoogleMap) {
this?.setOnCameraMoveListener(this@AddAddressFragment)
this?.setOnCameraIdleListener(this@AddAddressFragment)
}
}
}
Below are the logs printed in onCameraIdle and onCameraMove functions:
override fun onCameraIdle() {
Log.d("CameraIdle", "Camera Idle called)
}
override fun onCameraMove() {
Log.d("TAG", "Camera moved")
}
Both onCameraIdle and onCameraMoved are called continuously, how to stop that?