I am trying to show Place on map. But I am not able to see icon on the maps. following is my code snippets..
Image img = Image.createImage(imgbyte, 0,imgbyte.length);
Place[] p = {new Place(1,new PlaceLabel("test"), img,42,-71)
,new Place(1,new PlaceLabel("test"), img,42,-70)
,new Place(1,new PlaceLabel("test"), img,41,-71)};
mapComponent.addPlaces(p);
any suggestion why its failing?
Thanks Jaak it's working now. Now places shows up on the map. Now another issue. Not able to get placeListener working
mapComponent.setPlaceListener(this);
implemented 3 method
PlaceLeft
PlaceEntered
Placeclicked
Any feedback highly appreciated.
Please describe more what you try to get and do not get.
To use the listeners you need 3 steps:
1. add "implements Placelistener" to class header
2. add .setPlaceListener(Implementing class)
3. implement the 3 methods
Maybe "placeEntered/Left" is a bit confusing name in terms of touchscreen. With touch-screen first click is "placeEntered" (unless some other place was selected already, then it is "placeLeft" for last selected object). Then second click to the same object is "PlaceClicked" event.
With non-touchscreen "Entered" means that cursor in moved nearby center of map is nearby place icon.
Note that PlaceListener is applicable only for point places. For all geometries: points, lines and polygons use new OnMapElementListener and it's similar functions.
Also make sure that you have cursor set, there is different forum thread about it: http://www.nutiteq.com/content/errors-tutorial-mapslib0100#comment-88
Jaak:
Do I need to implement touchEvent for Place or if I implement PlaceListener with three method will be sufficient. Because the reason is I am able to place places on map but not able to fire any of the method. PlaceLeft, PlaceEntered or PlaceClicked. Do we need to fire this method or Listener will handle click event?
For Java ME platforms just PlaceListener is enough.
If you mean BlackBerry Storm platform here, then there you need to implement touchEvent, as library has no built-in implementation for that.
Maybe you mean different coordinate order: -71,42 ? Your code puts points to Antarctica, maybe you were looking them from New York state, where they are if lot and lang are swapped?
/JaakL