Map API

Nutiteq Maps Lib SDK enables developing advanced mobile mapping applications.
Platforms: Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

» View demos
» Downloads

Uudised

Viimane: Tue, 17 May 2011 13:21:59
Teema: Nutimap Eesti kaardi asemele
Veel uudiseid »

Can't Add a POI

2 replies [Last post]
Byron
User offline. Last seen 38 weeks 2 days ago. Offline
Joined: 03/22/2010

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?

jaak
User offline. Last seen 12 hours 17 min ago. Offline
Joined: 06/19/2008

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

Byron
User offline. Last seen 38 weeks 2 days ago. Offline
Joined: 03/22/2010

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());
}