0
String url = "http://maps.google.com/maps/api/staticmap";url
           += "?zoom=13&size=" + width + "x" + height;url
           += "&maptype=roadmap";url
           += "&markers=color:red|label:A|"
           + lat
           + ","
           + lon; url
           += "&sensor=true";

My first attempt was to get a static map with my center location and my zoom level and it worked but when I'm adding markers to the URL I'm getting the same image but no markers.

I'm doing exactly the same from the Google Map API Doc but i cant figure out whats wrong.

Is there any other way to show map in j2me application??

GitaarLAB
  • 14,536
  • 11
  • 60
  • 80
Parmanand
  • 355
  • 2
  • 6
  • 15

1 Answers1

0

There are fundamentally two ways to show maps in a Java ME application. Your method of making an HTTP request to a map server is best suited to situations where all you need is one single map image. Since each map update will require more network traffic. If you need a series of images, add custom markers or you want to dynamically update the map, you would be much better off using a dedicated library which uses a tile server, caches your map tiles and overlays objects on top of it. The reasoning behind this is described here

The dynamic mapping library I would recommend is the HERE Maps API for Java ME, as you can tell from the name, the API is specifically designed to work with Java ME devices.

The API is currently bundled with the Nokia Asha SDK 1.0, but despite this, it is in reality a separate independent plugin and has been designed to work with the full range of standard Java ME devices.

A similar Stack Overflow question answered here describes how to download it.

The code to display a marker on the map can be found in the Developer's Guide

map.setState(new MapDisplayState(new GeoCoordinate(51.477, 0.0, 0), 15));

MapStandardMarker marker = mapFactory.createStandardMarker(
        new GeoCoordinate(51.477, 0.0, 0), 10, "Hi!", 
        MapStandardMarker.BALLOON);
marker.setColor(0xFFFF0000);  // Color is red
map.addMapObject(marker);

As a notice of affiliation, I should mention in passing that I do work for Nokia.

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