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
New Contributor
Posts: 4
Registered: ‎04-28-2011
My Device: torch
My Carrier: att

Maps with clickable pins

I am displaying a few location on map using RichMapField,  MapLocation, and MapDataModel (BlackBerry JDE 6.0.0).

How I can capture click or touch on location pin/marker to go to the detail screen?

How can I display user's current location using different pin (to distinguish from other markers)?

Is that possible, or should I use different approach?

Thanks,

Boogy

Developer
Posts: 207
Registered: ‎09-10-2010
My Device: Not Specified

Re: Maps with clickable pins

Welcome to forums. Have you tried searching on forums? I remember there were some discussions on what you are trying to achieve including some example code.
New Contributor
Posts: 4
Registered: ‎04-28-2011
My Device: torch
My Carrier: att

Re: Maps with clickable pins

I did try searching, but no luck.

If anybody knows where is the good answer, please post a link!

 

Thanks,

Boogy

 

Contributor
Posts: 15
Registered: ‎04-27-2011
My Device: Storm 2-9550
My Carrier: Verizone

Re: Maps with clickable pins

Developer
Posts: 254
Registered: ‎03-15-2011
My Device: simulator
My Carrier: simulator

Re: Maps with clickable pins

There is API´s to have different marker.. But you can try extending the RichMapField and add your own marker.. But I think it might be complex if you have many pointers (when you want to show each with different representation)

 

To capture the touch on location , may be you can try to make use of the API 

convertWorldToField() , which converts the coordinates to Pixels to place it on the screen...

(Note : I have not tried it.. Just this will be the first one I will experiment with when hearing your requirements..)

------------------------------------------------------------------------------------------------
Click "Accept as Solution" if post was what you needed. Give kudos if you feel response is helpful.

New Contributor
Posts: 4
Registered: ‎04-28-2011
My Device: torch
My Carrier: att

Re: Maps with clickable pins

Thanks sheeluwiki,

I believe your answer leading in good direction, but a few more questions:

what RichMapField's property to use to set icon used for marker?

Should I overwrite touch event, do you have any sample code for that?

 

Thanks! 

Developer
Posts: 254
Registered: ‎03-15-2011
My Device: simulator
My Carrier: simulator

Re: Maps with clickable pins

RichMapField extends MapField..

 

May be you can override the paint() method for the customerized marker purpose.. The below code snippet can be used for reference.. But I am not sure if this is the correct method to be overriden..

 

 protected void paint(Graphics graphics) {
        super.paint(graphics);
                if(myLocation != null) {

                       Coordinates co = mapField.getCoordinates();
                       co.setLatitude(Double.parseDouble(myLocation.getLat()));
                       co.setLongitude(Double.parseDouble(myLocation.getLng()));
                
                        XYPoint point = new XYPoint();
                        mapField.convertWorldToField(co, point);
                
                       Bitmap bitmap = Bitmap.getBitmapResource(myLocation.getImageName());
                       graphics.drawBitmap(point.x, point.y, bitmap.getWidth(), bitmap.getHeight(), bitmap, 0, 0);

              }

  }

 

Please also look into below URLs for API reference..

 

http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/lbs/maps/ui/RichMapField.html

 

http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/lbs/maps/ui/MapField.html

 

I think you have to override the touchevent() of the Mapfield to capture your touch events..

------------------------------------------------------------------------------------------------
Click "Accept as Solution" if post was what you needed. Give kudos if you feel response is helpful.

Developer
Posts: 51
Registered: ‎08-07-2008
My Device: Not Specified

Re: Maps with clickable pins

using RichMapField andMapLocation, on the map is showed automatically a baloon with the info of location added. I need to know when the user click on this ballon or touch. How can I catch this event ?

Developer
Posts: 253
Registered: ‎08-14-2010
My Device: Not Specified

Re: Maps with clickable pins

I am  looking for a solution for same issue.

 

anyone to help?

 

 

 

Developer
Posts: 253
Registered: ‎08-14-2010
My Device: Not Specified

Re: Maps with clickable pins

why any senior developer do not help on this topic???