There are several ways you could do this, ranging from the very simple to the more complex. The approach you should take would depend upon what you are planning to do with them map.
1) The simplest method would be to use the RESTful Maps API directly within a lwuit HTMLComponent - If you include the hc parameter, the map returned will be formatted HTML which the component can already render:
Code:
HttpRequestHandler handler = new HttpRequestHandler();
HTMLComponent htmlC = new HTMLComponent(handler);
htmlC.setPage("http://m.nok.it/?c=-23.561389,-46.656389&h=400&w=330&hc&nord&z=15");
The API reference can be found here : http://www.developer.nokia.com/Devel...API_Reference/
At a minimum, you would need to supply the longitude, latitude and zoom level.
The advantage of this method is it is very easy to implement and professionally styled.
The disadvantage is that it is inflexible. If the map returned by the hc parameter isn't what you want then you need another approach.
2) The next level up in complexity would be to create your own class extending the lwuit Component , and use the RESTful Maps API (again) in the override of the paint() method
Code:
public class MyComponent extends Component {
public void paint(Graphics g) {
im = getImage()
if (im != null) {
g.drawImage(im, 10, 10, Graphics.LEFT | Graphics.TOP);
}
}
}
An example of how to create the URL and retrieve the Image in getImage() method can be seen here: http://www.developer.nokia.com/Commu...I_with_Java_ME
You could of course extend the paint() method add to additional stuff over the map, such as text for example.
For both of the methods discussed so far, every alteration will invoke a new http request and will require another image to be downloaded.
3) It is possible (though slightly complex) to combine Canvas based operations with lwuit, through creating a lwuit component as a wrapper and then moving the canvas paint() code inside the component paint() method.
The code would be very similar to the CustomMapItem described here:
http://www.developer.nokia.com/Commu...PI_for_Java_ME
(though it would extend the lwuit Component rather CustomItem) - access to the mapFactory would then allow you to add markers and so on.
You would the be able to take advantage of the in-built map tiling and caching , which would reduce the network traffic. The only disadvantage of this method is that you wouldn't get panning, zoom or interactivity out of the box. You would need to add methods to do this to your Component Event Handling interface if you need them.
Option 3) would be the most comprehensive solution, though I would definitely recommend you comprehensively test your solution on various devices. Since Options 1) and 2) are http based, they should work easily on any device, and may be acceptable to you if you do not need to keep regularly updating your map.