BlackBerry map with multiple markers
I want to create a blackberry application which displa开发者_Go百科ys a custom map with many markers. Each marker should be clickable and when clicking on it, more information will display. Also, the map should allow the user to navigate around.
You could extend the class
net.rim.device.api.lbs.MapField
and implement the paint method to display your custom markers.
Overriding navigationMovement
and keyChar
will help you to implement the navigation as you want it to be .
To make the markers clickable on non-touch devices, you'll need some kind of cursor.
On touch devices you can work with pointerReleased.
you could use this code in mapfield touchEvent class,this will allow you to navigate thru mapfield on moving ur finger on touchscreen,hope this will solve your problem
public boolean touchEvent(TouchEvent message){
int x=message.getX(1);
int y=message.getY(1);
if(message.getEvent()==TouchEvent.MOVE){
XYPoint _xyIn = new XYPoint();
XYPoint _xyOut = new XYPoint();
_xyIn.x=x;
_xyIn.y = y;
convertFieldToWorld(_xyIn,_xyOut);
map.moveTo(_xyOut.y,_xyOut.x);
return true;
}
return false;
}
精彩评论