2

I have already written an app that uses GoogleMaps Api v1 in Android. This app uses several Overlays (or ItemizedOverlays) which handle a bunch of things autonomously (ie. lazy loading markers, as I have a whole lot of them and adding them all at once will force the app to close). I also use them as an interface for the user: He can decide which overlays (or which kind of markers from his perspective) he wants to see. I add or remove these Overlays accordingly. Now I want to switch to the new maps-v2-api. The documentation makes no mention of Overlays, and it seems that one cannot extend Markers as they are final.

Am I forced to kind of emulate the previous maps behavior, to be able to add and remove Overlays which handle Markers themself? Does anyone know a reason why Google removed this useful facility, and forces any developer to completely rewrite the GoogleMaps related code? I like to know also a reason for making the Marker class final, thus preventing anyone to add something related to it? (solutions I see store a global HashMap with the marker as key, and the infos they need as value, which is - in my point of view, very ugly considering that markers may have different models which are related to them).

JJD
  • 50,076
  • 60
  • 203
  • 339
Rafael T
  • 15,401
  • 15
  • 83
  • 144

1 Answers1

4

Am I forced to kind of emulate the previous maps behavior, to be able to add and remove Overlays which handle Markers themself?

Yes.

Does anyone know a reason why Google removed this useful facility, and forces any dev to completely rewrite the GoogleMaps related code?

Google engineers probably know the reason.

All I know that, for simple scenarios, the new approach requires less code. Maps V1 requires overlays, and overlays are overkill for many apps.

I like to know also a reason for making the Marker class final, thus preventing anyone to add something related to it?

Because the Marker is used for IPC and is not really retained within your process. Pretty much anything you do with Maps V2 results in IPC calls, based on Cyril Mottier's research.

JJD
  • 50,076
  • 60
  • 203
  • 339
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks for the mention of Cyril Mottier's research. I found his article very useful at http://android.cyrilmottier.com/?p=855 – Rafael T Jan 25 '13 at 22:31