0

I'm using Lwuit to develop app on nokia s40 SDK 2.0 I have to add a Map to my application.. So i hav used the code given below but the screen doesnot display anything. I get a blank screen. How can I display this on lwuit form or container? (the code runs completely and exits without errors & 'END' is printed)

ApplicationContext.getInstance().setAppID("ruKXq--------Sbgq"); ApplicationContext.getInstance().setToken("kWRp_Vp---------AG7rw");

      Display display = Display.getDisplay(COMPANY_Midlet.getInstance());
      MapCanvas mapCanvas = new MapCanvas(display) {
          public void onMapUpdateError(String description, 
              Throwable detail, boolean critical) {
              // Error handling goes here.
          }
          public void onMapContentComplete() {
          }
      };

      mapCanvas.getMapDisplay().setState(
          new MapDisplayState(new GeoCoordinate(52.51, 13.4, 0), 10));

      System.out.println(mapCanvas.getMapDisplay().getState());

      display.setCurrent(mapCanvas);

      System.out.println("END");

1 Answers1

0

Architecturally the most elegant way would be to create a custom LWUIT component which encapsulates the MapCanvas and exposes a standard LWUIT interface - in other words basic use of an adaptor pattern. There is an example of this pattern to be found within the Nokia Projects Tourist Attractions example (the version updated for LWUIT). Additionally sample code for such a component can be found on GIT hub here

Jason Fox
  • 5,115
  • 1
  • 15
  • 34