1

I am looking for a way to receive events when a map finished panning or zooming or panning and zooming. Those events are not fired, afaik, from MapActivity in the SDK for Android 2.3.3 which I use. I tried the MapChange library, however, it forces you to use Handler in your MapActivity to ensure to that UI updates are processed on the UI thread; more information.

Question: Do you know of any support for such events by the Android Support Library e.g. by using FragmentActivity instead of MapActivity - I could not find an alternative solution by now.

Similar questions can be found here:


Edit: The MapChange library was updated some hours ago. I will check out what has been improved.


Edit: The MapChange library has been improved and works much more reliable now and is a good option! Please checkout the GitHub project for further information. However, I leave the question open since I am still interested whether one can do the same with existing components.

Community
  • 1
  • 1
JJD
  • 50,076
  • 60
  • 203
  • 339

3 Answers3

1

You can use the GoogleMap.OnCameraChangeListener to assign a listener to the changing camera event. Handling that and other events is discussed in the Google Maps Android API documentation.

schminnie
  • 51
  • 1
  • 3
0

Why is it a problem to use a Handler ? You can always post your UI changes to the main thread, why not do that ?

Someone on SO found a way to get a Fragment activity to contain a MapView by changing the support library code but it became too cumbersome for me to use and I reverted to a full-blown Map activity.

Philippe Girolami
  • 1,876
  • 1
  • 13
  • 15
  • The way Runnables and Handler are used in [MapChange](https://github.com/bricolsoftconsulting/MapChange/tree/3637b8f4f6a97a08ce30a029ee44095aed5e9519/src/com/bricolsoftconsulting/mapchange) appear to me a bit overhead. I wonder how other projects receive such events. – JJD Jul 17 '12 at 09:55
0

For anyone still looking for an answer to this

googleMap.setOnCameraIdleListener {
                //Do your thing
            }

called when camera movement has ended

M. Usman Khan
  • 3,689
  • 1
  • 59
  • 69