Android Tutorial OSMDroid - MapView for B4A tutorial

Discussion in 'Tutorials & Examples' started by warwound, Mar 26, 2012.

  1. Spectre

    Spectre Active Member Licensed User

    I saw something that the labels seem to turn bad compared to the map. I set the orientation map with the magnetic sensor, it seems that overlay the label is in a different orientation or different overlay...
    I confirm that depends on the orientation map ... If you orient the map with the compass labels moving ... if I disable orientation map it all works ...

    Best Regards, Riccardo
  2. eronquillo

    eronquillo Member Licensed User

    Hi Martin, thanks for your help on this. It gives me something to move forward with. Thanks again!
  3. warwound

    warwound Expert Licensed User


    Ah so that was the cause.
    The map is a Canvas that can be rotated.
    The Labels are Views added to the layout, anchored to a GeoPoint on the Canvas BUT the anchor point does not take into account map rotation.

    There is a possibility that these Views (ViewHost objects) could be converted to a Bitmap and then drawn onto the map Canvas instead of being added to the layout as Views.
    I looked at this while developing the ViewHostOverlay - hoping to make it an option to draw a View on the Canvas OR add it to the layout.
    Time is the limiting factor here and i just didn't have time to create such an option.

    I'm likely to be busy for a couple for weeks here getting some work done but will think again about this option when i next update OSMDroid.

  4. Spectre

    Spectre Active Member Licensed User

    Hi Martin...
    Important thing is to have found the problem, for now I will visualize the label on the map, my project can be expected in the meantime I will go on with other parties. It seems like a good option to convert to a bitmap and then add to a single overlay.
    I also thought I had to work around the problem of generating an icon with the name of the point and then use it on the map ...

  5. fabio.guerrazzi

    fabio.guerrazzi Member Licensed User

    I didn't figured out wich one should I follow for my app, Google Maps v2 Tutorial or OSMDroid MapView. I just installed the first one, created signature, got api key.. now I realized this. What is the best way in your opinion? thank you
  6. Spectre

    Spectre Active Member Licensed User

    osmodroid in my opinion is the most complete and versatile ... You can use off-line maps and the new version 4.1 beta is very good though.
  7. warwound

    warwound Expert Licensed User

    In my opinion the GoogleMaps library is far more 'professional' and is also regularly updated with new features.
    GoogleMaps does though mean that your app will only be compatible with devices running a version of android Honeycomb and later - it doesn't support the older 2.? versions of android.
    GoogleMaps is also limited from a developers point of view as it lacks any way to enhance it with your own objects and classes.

    OSMDroid is 'functional' and feature rich and allows developers to enhance it's functionality with their own objects and classes.
    Just a couple of weeks ago i created the new CircleOverlay for Spectre to use in the new version 4.1 of OSMDroid.
    OSMDroid is compatible with just about every version of android so no problems with older devices.
    OSMDroid is updated 'regularly' but not as often as GoogleMaps is updated.

    Each has it's good points and weak points.

    Euxaes likes this.
  8. Spectre

    Spectre Active Member Licensed User

    [Quote = "warwound, palo: 247.086, membro: 11161"] A mio parere la biblioteca GoogleMaps è molto più 'professionale' e viene regolarmente aggiornato con nuove funzionalità.
    GoogleMaps non significa però che la vostra applicazione sarà compatibile solo con i dispositivi che esegue una versione di Android Honeycomb e poi - non supporta la vecchia 2.? versioni di Android.
    GoogleMaps è limitata anche da un punto di vista gli sviluppatori in quanto manca qualsiasi modo per migliorare con i propri oggetti e classi.

    OSMDroid è 'funzionale' e ricco di funzionalità e consente agli sviluppatori di migliorare la sua funzionalità con i propri oggetti e classi.
    Solo un paio di settimane fa ho creato il nuovo CircleOverlay per Spectre da utilizzare nella nuova versione 4.1 di OSMDroid.
    OSMDroid è compatibile con quasi tutte le versioni di Android quindi niente problemi con i dispositivi più vecchi.
    OSMDroid è aggiornato 'regolarmente', ma non così spesso come GoogleMaps viene aggiornato.

    Ognuno ha la sua buona punti e punti deboli.

    Martin. [/ Quote]
    warwound likes this.
  9. Spectre

    Spectre Active Member Licensed User

    Hi! Martin ... Some news for the bug rotation label on the map?
  10. warwound

    warwound Expert Licensed User

    lol it'll be a while before i have time to look at that - gotta get some other work done first.
    Updating the ViewHost so that Views are drawn onto the map Canvas instead of being displayed as 'standard' Views isn't an easy bit of code to write, so i'll look at it when i know i have enough time to get it working.

  11. Spectre

    Spectre Active Member Licensed User

  12. jamesnz

    jamesnz Active Member Licensed User

    what an awesome library, the only issue I have is with screen rotation I get out of memory errors, usually after 2 'rotations' , not sure why but otherwise it's really great, well done
  13. Mbm

    Mbm Member Licensed User

    Is there any way to use OSMDroid library together with googlemaps api in the same proyect? Both libraries have a class called Marker and the IDE doesn´t allow the same short name for classes...
  14. warwound

    warwound Expert Licensed User

    Have a read of this post:
    I can't remember offhand whether that recompiled version is the latest version or not - you'll have to download it and check.

  15. Mbm

    Mbm Member Licensed User

  16. Kbogle24

    Kbogle24 Member Licensed User

  17. Sam H

    Sam H Member Licensed User

    I was trying to use the example in post #375, however I get the following error message during compilation:
    "A referenced library is missing: slf4j-android-1.6.1-rc1". I have the following librarys referenced:

    What am I missing?, thanks in advance.
  18. warwound

    warwound Expert Licensed User

    That example uses OSMDroid version 4.1 - you don't need version 3.0.8 to run it and you don't need MapsForgeTileSource either.
    The latest version 4.1 library files can be downloaded from here: (not sure if you have the latest version 4.1 or not).

    Can you make sure you have OSMDroid version 4.1 library checked in the b4a ide and no other libraries checked?

  19. Sam H

    Sam H Member Licensed User

    Thanks, I have found the slf4j-android-1.6.1-rc1 library reference in the files from the download link and added it to the librarys folder. That seems to have done it.

    Thanks again

  20. Sam H

    Sam H Member Licensed User

    A few slight problems since upgrading the library from OSMDroid 3_0_8 to OSMDroid 4_1. I can no-longer trigger the following sub by clicking on any of the markers:
    Sub MarkersOverlay1_Click(Title As String, Description As String, Point As OSMDroid_GeoPoint)
    End Sub

    Any ideas?

    Also the mylocationOverlay didn't work.

    Are there any tutorials/examples for OSMDroid 4_1, like there were for 3_1 on the first page of this tutorial as they were really useful?


  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice