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
Regular Contributor
Posts: 92
Registered: ‎01-31-2012
My Device: curve 8520
My Carrier: vodafone

MapField doesn't display on real device

hi guys um using mapfield to add location with pins but actually it doesn't display on the real device it appears like a blanck white screen how can I solve this proble.... that's the class which add pins to the mapField

 

import net.rim.device.api.lbs.maps.model.MapDataModel;
import net.rim.device.api.lbs.maps.model.MapLocation;
import net.rim.device.api.lbs.maps.model.MapPoint;
import net.rim.device.api.lbs.maps.model.Mappable;
import net.rim.device.api.lbs.maps.ui.MapAction;
import net.rim.device.api.lbs.maps.ui.MapField;
import net.rim.device.api.system.Display;

public class MapFieldWithPins extends MapField {
	private int iWidth;
	private int iHeight;
	public final static short ZOOM_STREET_VIEW = 2;

	public MapFieldWithPins() {
		this.iWidth = Display.getWidth();
		this.iHeight = Display.getHeight();
		this.setAutoUpdate(true);
	}

	public MapFieldWithPins(int iWidth, int iHeight) {
		this.iWidth = iHeight;
		this.iHeight = iHeight;
		this.setAutoUpdate(true);
	}

	public MapFieldWithPins(int iWidth, int iHeight, double centerLantidute,
			double centerLongitude, short zoom) {
		super(iWidth, iHeight);
		// action
		MapAction action = this.getAction();
		action.setCentreAndZoom(new MapPoint(centerLantidute, centerLongitude),
				zoom);
	}

	public void setCenterAndZoom(double centerLantidute,
			double centerLongitude, short zoom) {
		// action
		MapAction action = this.getAction();
		action.setCentreAndZoom(new MapPoint(centerLantidute, centerLongitude),
				zoom);
	}

	public void addPins(MapLocation[] location) {
		MapDataModel data = this.getModel();
		for (int i = 0; i < location.length; i++) {
			int locationID = data
					.add((Mappable) location[i], String.valueOf(i));
			data.tag(locationID, String.valueOf(i));
			Mappable datamap = (Mappable) location[i];
			data.add(datamap, String.valueOf(i), true);
			data.setVisible(String.valueOf(i));
		}
	}

	protected void layout(int width, int height) {
		super.layout(iWidth, iHeight);
		setExtent(iWidth, iHeight);
	}

}

 

 and that's the class in charge of the screen

 

super(DEFAULT_MENU | DEFAULT_CLOSE);
		MapFieldWithPins fieldWithPins = new MapFieldWithPins();
		add(fieldWithPins);
		fieldWithPins.setCenterAndZoom(30.541532, 31.208743,
				MapFieldWithPins.ZOOM_STREET_VIEW);

		fieldWithPins.addPins(new MapLocation[] { new MapLocation(30.041532,
				31.208743, "My Location", null) });

 

Developer
Posts: 141
Registered: ‎07-13-2011
My Device: BB Bold
My Carrier: Vodafone

Re: MapField doesn't display on real device

Check wheather your handset has got maps installed.

 

Can you access maps from blackberry.

Regular Contributor
Posts: 92
Registered: ‎01-31-2012
My Device: curve 8520
My Carrier: vodafone

Re: MapField doesn't display on real device

what ? , should I install blackberry maps to display it within my app ?
Developer
Posts: 141
Registered: ‎07-13-2011
My Device: BB Bold
My Carrier: Vodafone

Re: MapField doesn't display on real device

I think so 

 

see the docs

 

Map field renders a map using the current mapping service.

Regular Contributor
Posts: 92
Registered: ‎01-31-2012
My Device: curve 8520
My Carrier: vodafone

Re: MapField doesn't display on real device

actually the map view as I think !,I need to implement map in my app without force the user to install the blackberry maps
Developer
Posts: 141
Registered: ‎07-13-2011
My Device: BB Bold
My Carrier: Vodafone

Re: MapField doesn't display on real device

Blackberries comes with default maps... which is used by mapfield to render it self.

 

Can you do a test for me..

click the blackberry button,,,,and see if u have got maps icon.

 

Can you tell me your location (country)....because the co-ordinates u r passing are of Cairo.....

Regular Contributor
Posts: 92
Registered: ‎01-31-2012
My Device: curve 8520
My Carrier: vodafone

Re: MapField doesn't display on real device

yeah it's in cairo and my blackberry doesn't display map icon when I pressed blackberry button
Developer
Posts: 141
Registered: ‎07-13-2011
My Device: BB Bold
My Carrier: Vodafone

Re: MapField doesn't display on real device

u need to check with ur provider how to download maps for ur country.

Regular Contributor
Posts: 92
Registered: ‎01-31-2012
My Device: curve 8520
My Carrier: vodafone

Re: MapField doesn't display on real device

is maps are default on any blackberry device ?

Developer
Posts: 141
Registered: ‎07-13-2011
My Device: BB Bold
My Carrier: Vodafone

Re: MapField doesn't display on real device

it is best to check with the provider.....

 

 

-----------------------------------------------------------

Do not forget to press Like