I am trying to ADD a POI
I have a program that has the same code as the blackberry tutorial but instead of showing a user position via GPS, I want to show a location of a POI
I am using the code below:
.....code here is same as blackberry tutorial.....
map.startMapping();
//Show a POI
try
{
final Image poiImage = Image.createImage("res/gps_marker.png");
PlaceLabel poiLabel =new PlaceLabel("test1");
Place p=new Place(1, poiLabel, poiImage,-114.057312,51.050459);
map.addPlace(p);
}
catch (final IOException e)
{
Dialog.alert(e.toString());
}
But I am getting the error:
JVM Error 104 uncaught:
NullPointerException
The problem seems to happen on the Image.createImage() call
what I am doing wrong?
This is how I manage to solve the problem:
1. create a folder call icons inside your BB solution
2. place the images that you want there eg. gps_marer.png
3. reference the image as "/icons/gps_marer.png"
try
{
Image poiImage = Image.createImage("/icons/gps_marer.png");
PlaceLabel poiLabel =new PlaceLabel("test1");
Place p=new Place(1, poiLabel, poiImage,-114.057312,51.050459);
map.addPlace(p);
}
catch ( IOException e)
{
Dialog.alert(e.toString());
}
The issue is in the reference to the image. Either the path should be different, perhaps "gps_marker.png", or the image is for some reason not included in application package at all, due to builder/IDE configuration.
/JaakL