From last day I am searching how to draw clickable pin on lat long on blackberry maps in os 5.0. I draw image on particular lat long but I want to go another screen by clicking that image.
Thanks In advance.
From last day I am searching how to draw clickable pin on lat long on blackberry maps in os 5.0. I draw image on particular lat long but I want to go another screen by clicking that image.
Thanks In advance.
I had done like this using Google maps.
String initial = "<!DOCTYPE html>\r\n" +
"<html> \r\n" +
"<head> \r\n" +
" <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" /> \r\n" +
" <title>Google Maps Multiple Markers</title> \r\n" +
" <script src=\"http://maps.google.com/maps/api/js?sensor=false\" \r\n" +
" type=\"text/javascript\"></script>\r\n" +
"</head> \r\n" +
"<body>\r\n" +
" <div id=\"map\" style=\"width: 360px; height: 390px;\"></div>\r\n" +
"\r\n" +
" <script type=\"text/javascript\">\r\n" +
" var locations = [";
String second= " ];\r\n" +
"\r\n" +
" var map = new google.maps.Map(document.getElementById('map'), {\r\n" +
" zoom: 8,";
String centerPoint ="";
String finalpart = " mapTypeId: google.maps.MapTypeId.ROADMAP\r\n" +
" });\r\n" +
"\r\n" +
" var infowindow = new google.maps.InfoWindow();\r\n" +
"\r\n" +
" var marker, i;\r\n" +
"\r\n" +
" for (i = 0; i < locations.length; i++) { \r\n" +
" marker = new google.maps.Marker({\r\n" +
" position: new google.maps.LatLng(locations[i][1], locations[i][2]),\r\n" +
" map: map\r\n" +
" });\r\n" +
"\r\n" +
" google.maps.event.addListener(marker, 'click', (function(marker, i) {\r\n" +
" return function() {\r\n" +
" infowindow.setContent(locations[i][0]);\r\n" +
" infowindow.open(map, marker);\r\n" +
" }\r\n" +
" })(marker, i));\r\n" +
" }\r\n" +
" </script>\r\n" +
"</body>\r\n" +
"</html>";
html=new StringBuffer();
html.append(initial);
point = "['"+name[i]+"',"+lat[i]+","+ lon[i]+","+i+"],";
html.append(point);
html.append(second);
html.append(centerPoint);
html.append(finalpart);
//System.out.println("Plot is"+html.toString());
BrowserFieldConfig _bfConfig = new BrowserFieldConfig();
_bfConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
_bfConfig.setProperty( BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE );
_bfConfig.setProperty(BrowserFieldConfig.USER_AGENT, "MyApplication 1.0");
BrowserField myBrowserField = new BrowserField(_bfConfig);
myBrowserField.displayContent(html.toString(), "");
HorizontalFieldManager horf=new HorizontalFieldManager(HORIZONTAL_SCROLL);
horf.add(myBrowserField);
add(horf);
When i click the pin, it will show the name of the user.
This is very similar to another recent question. In the other question, the poster was asking how to draw a custom image for the map pin (marker). It's not clear to me whether you want a custom image as your map pin, or not. But, if you do, and are happy to use MapField, then
You just don't need to worry about the part where I draw a second layer on the pin, for the round user profile picture.
But, you will still override the paint()
method to draw your custom pin, then determine the location of the user touch/click on the map, and calculate distance from that touch/click to the pin, to determine which pin was clicked. Handling the touch/click will work differently for touchscreen and non-touchscreen devices, but I link to the API methods you will need to use for both.