Hey. I am having trouble setting up the OSMdroid library to display OpenSourceMaps. I am working on an activity that will allow the user to see a map of their current location wit buttons to allow the user to switch between normal google maps view, terrain google maps view, and openstreetmaps view. I am currently using the JAR file and just adding it to the build path of my project. It compiles fine however I don’t understand how to use the library. There are very few tutorials/directions online. Do I need to make an IMapView tag in the layout and use it like a Google Map view? How do I switch the layout tiles from normal google maps view?
If someone could just give me a very short walkthrough of how this library works it would be much appreciated. I have been coding in JAVA for numerous years so I just need an english description of what I need to do.
Thanks in advance.
I managed to get osmdroid working in a project, but had to have the Google and the OSM views in different activities as if you switch a Mapview from Google to OSM and then try to go back to Google, I got a runtime error saying something like “only one mapview allowed per activity”. This results in a lot of duplicate code but it does run OK.
Use the latest osmdroid-android-3.0.3.jar, it’s much simpler for drawing overlays. You’ll also need to include slf4j-android-1.5.8.jar. For what it’s worth here is the code for the lashed up demo that used to start with. It’s got a location listener and draws a very simple overlay (line across the screen) If you are familiar with Google Maps, you should be able to adapt it for your purpose.
And the xml (copymain.xml)