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
Developer
Posts: 261
Registered: ‎08-11-2009
My Device: Not Specified
Accepted Solution

Map field or invoke map

Hi Developers,

 

 

I need to show the map in my own screen , i have used the invoke application methord to open the default map but the problem is that i dont have any control over the screen , what i need is to draw pin points where  ever i click on the map screen and a botton which will send the latitutde  and longitude  value of the inserted pin points .

 

                  is it possible to implement this using invoke map or i need to do it using the mapfield . is so in the mapfield please let me know how the pin points can be drawn .

 

 

Thanks

sujithravindran

Developer
Posts: 588
Registered: ‎05-29-2009
My Device: 9100

Re: Map field or invoke map

Yes, you'll have to do it with your own map field. You can have a look into MapFieldDemo. It does something similar.

Developer
Posts: 261
Registered: ‎08-11-2009
My Device: Not Specified

Re: Map field or invoke map

Thanks ibarrea,

 

plz  throw some light on drawing the multiple pin point on the map

 

 

 

Thanks

sujith 

Highlighted
Developer
Posts: 92
Registered: ‎02-22-2011
My Device: Not Specified

Re: Map field or invoke map

For drawing many points on the map you have to override de MapField paint method

 

 

protected void paint(Graphics g){
	super.paint(g);
	Coordinates c=this.getCoordinates();
	XYPoint point;
	Bitmap b;
	
	//Tendremos que hacer un bucle para pintar los puntos
	for(int i=0; i<my_vector.size(); i++){
		c.setLatitude((float)my_vector.elementAt(i).getLat/100000);
		c.setLongitude((float)my_vector.elementAr(i).getLon/100000);
			
		point = new XYPoint();
		this.convertWorldToField(c, point);
		b = Bitmap.getBitmapResource("point.png");
		g.drawBitmap(point.x, point.y, b.getWidth(), b.getHeight(), b, 0, 0);
			
	}	
}