I want to create a map with static marker to always show the location of center of screen. I've created a marker in layout with drawable image in the center. Now I need to get the center location coordinates and convert them to address. afterwards show the selected location in a text view as my selected location. Need help
Get the coordinates of a place On your computer, open Google Maps. Right-click the place or area on the map. This will open a pop-up window. You can find your latitude and longitude in decimal format at the top.
You can get center point of map at any time by calling this function on your GoogleMap variable instance
mMap.getCameraPosition().target
Now if you want to get center point everytime map is changed then you need to implement OnCameraChangeListener
listener and call the above line to get new center point.
Update: OnCameraChangeListener
has been replaced with OnCameraMoveStartedListener
, OnCameraMoveListener
and OnCameraIdleListener
listeners. Use the one that suits your use case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With