Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified
Accepted Solution

Error trying to invoke BlackBerry Native Map with location document

Hello,

 

I am trying to invoke a BlackBerry native map (using the simulator) on the 5.0 OS.  I am also trying to plot multiple location markers with a location document.  My code is running successfully, except I am receiving the following error:

 

 

Thread [net_rim_bb_lbs(182)id=256121856] (Suspended (exception NullPointerException))	
	MapRect.intersects(short[]) line: 74	
	MapRender.renderLayer(BaseDataSource, Graphics, Maplet, Layer, MapRect, int, int, XYRect, XYRect) line: 331	
	MapRender.render(BaseDataSource, RenderListener, Graphics, MapRect, int, int, XYRect, XYRect) line: 483	
	BaseMapRenderer.render(BaseDataSource, RenderListener, Graphics, MapRect, MapRect, int, int, int, int, XYRect, XYRect) line: 47	
	BaseDataSource.render(RenderListener, Graphics, MapRect, MapRect, int, int, int, int, XYRect, XYRect, Transform) line: 247	
	RenderThread.renderImpl(Graphics, MapRect, MapRect, int, int, int, int, XYRect, XYRect) line: 259	
	RenderThread.run() line: 346	

 

 

Once I resume after the error in Debug mode, however, the map is showed correctly and the locations appear correctly.  Does anyone know what could be going on?  Here is my code:

 

 

if (vector != null) {

	document = "<lbs>";

	for (int i = 0; i < vector.size(); i++) {

		loc = (MyLocationClass) vector.elementAt(i);

		document += "<location x='"
				+ (int) (Double.parseDouble(loc.getStrLongitude()) * 100000)
				+ "' y='"
				+ (int) (Double.parseDouble(loc.getStrLatitude()) * 100000)
				+ "' label='" + loc.getStrLocationName()
				+ "' description='" + loc.getStrLocationAddress1() + " " + loc.getStrLocationAddress2()
				+ ", " + loc.getStrCity() + ", "
				+ loc.getStrState() + " " + loc.getStrZip4()
				+ "'/>";
	}

	document += "</lbs>";

	Invoke.invokeApplication(Invoke.APP_TYPE_MAPS,
			new MapsArguments(MapsArguments.ARG_LOCATION_DOCUMENT,
					document));
}

 

 

Any help would be appreciated. Thanks!

Developer
Posts: 723
Registered: ‎03-12-2009
My Device: Playbook

Re: Error trying to invoke BlackBerry Native Map with location document

The simulator has a lot of issues rendering maps properly (at least on my machine).

 

It works fine on an actual device.

Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified

Re: Error trying to invoke BlackBerry Native Map with location document

Yep, you're right. Works on the device. Thanks!