Search code examples
codenameone

Using Maps in Codename One


Can anyone assist me in adding a Map to a Form in Codename One? I've been reading and searching, and can't find an "updated" demo/tutorial on using the library effectively.

IDE - IntelliJ Build Tool - Maven


Solution

  • The old code works mostly the same as it did. The github project instructions are up to date and should work as expected. Just add the dependency and get the API keys from Google.

    Then all you need to do is create a BorderLayout Form and place the map within it. E.g.:

    Form mapForm = new Form(new BorderLayout());
    mapForm.add(CENTER, mapContainerInstance));
    mapForm.show();