Above all else one of the best features of the Google Maps API is the ability to add our own content to maps by overlaying them with our own material.
In this final exercise we will display a map at a particular location and then overlay it with our own imagery. We will also see how to translate from geographical locations to screen positions.
This task is a continuation of the previous one, so make sure you have completed this first and have it open in Eclipse.
Here we have used the built in icon.png
as our graphic but if you want to use your own, then add this first to a res/drawable
folder, ideally as a PNG file.
Mostly what is required here is a new class, which we can add as an inner class, but first we need to convert our MapView and MapController to class wide fields:
MapView mapView; MapController mapControl;
Now it is simply a matter of adding a new class to our MapActivity. It should be defined like this:
class MyMapOverlay...