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: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: Show multiple pin point on google map in blackberry

Hi i have to show the root between two point o google map in black berry 

please can you help me.

thanks ,

regards,

avinash

Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Re: Show multiple pin point on google map in blackberry

Hi,Avinash for plotting multiple points,in 5.0S i tested in 8900 curve device,it worked,which simulator you were testing?

For Multiple points,

package com.mapsdemo;

import java.util.Vector;

public class routeMap {
	//StringBuffer html = new StringBuffer();
	String firstPart = "<!doctype html>\r\n" + 
			"<html>\r\n" + 
			"<head>\r\n" + 
			"    <meta charset=\"utf-8\">\r\n" + 
			"    <title></title>\r\n" + 
			"    <script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?sensor=false\"></script>\r\n" + 
			"    <script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js\"></script>\r\n" + 
			"    <script type=\"text/javascript\">\r\n" + 
			"\r\n" + 
			"        var myRouter = {\r\n" + 
			"            map_: null,\r\n" + 
			"            directionsHelper_: null,\r\n" + 
			"\r\n" + 
			"            stores: [";
	String pointsPart = "";
	String centerPart = "";
	String sourcePoint = "",destinationPoint= "",centerPoint= "";
	String Latitude[]={"50.82788","51.02788"};
	String Longitude[] = {"3.76499","3.9",};
	String sourcePoints[] = {"50.82788", "3.26499"};
	//String destinationPoints[] = {"50.83788"," 3.56499"};
	String destinationPointstest = "Antwerp";
	String centerPoints[] = {"50.82788", "3.26499"};
	
	String secondPart = "  ],\r\n" + 
			"\r\n" + 
			"            calcRoute: function() {\r\n" + 
			"\r\n" + 
			"                var waypts = [];\r\n" + 
			"\r\n" + 
			"                for (var i in this.stores) {\r\n" + 
			"                    waypts.push({\r\n" + 
			"                        location: this.stores[i].location,\r\n" + 
			"                        stopover:true\r\n" + 
			"                    });\r\n" + 
			"                }\r\n" + 
			"                var request = {";
	
	String thirdPart = 	" travelMode: google.maps.DirectionsTravelMode.DRIVING\r\n" + 
			"                };\r\n" + 
			"\r\n" + 
			"                var _SELF = this;\r\n" + 
			"                this.directionsHelper_.route(request, function(response, status) {\r\n" + 
			"                    if (status == google.maps.DirectionsStatus.OK) {\r\n" + 
			"                        _SELF.directionsDisplay_.setDirections(response);\r\n" + 
			"                        return;\r\n" + 
			"                    }\r\n" + 
			"                    console.log('Directions Status: ' + status);\r\n" + 
			"                });\r\n" + 
			"            },\r\n" + 
			"\r\n" + 
			"            init: function(mapid) {\r\n" + 
			"\r\n" + 
			"                this.directionsHelper_ = new google.maps.DirectionsService();\r\n" + 
			"                this.directionsDisplay_ = new google.maps.DirectionsRenderer();";
	
	String finalPart = " var myOptions = {\r\n" + 
			"                    zoom:7,\r\n" + 
			"                    mapTypeId: google.maps.MapTypeId.ROADMAP,\r\n" + 
			"                    center: center\r\n" + 
			"                }\r\n" + 
			"                this.map_ = new google.maps.Map(document.getElementById(mapid), myOptions);\r\n" + 
			"                this.directionsDisplay_.setMap(this.map_);\r\n" + 
			"\r\n" + 
			"                this.calcRoute();\r\n" + 
			"            }\r\n" + 
			"        };\r\n" + 
			"\r\n" + 
			"        $(document).ready(function() {\r\n" + 
			"            myRouter.init('map');\r\n" + 
			"        });\r\n" + 
			"\r\n" + 
			"    </script>\r\n" + 
			"    <style type=\"text/css\">\r\n" + 
			"        #map {\r\n" + 
			"            height: 500px;\r\n" + 
			"            width: 600px;\r\n" + 
			"            border: 1px solid #000;\r\n" + 
			"        }\r\n" + 
			"    </style>\r\n" + 
			"</head>\r\n" + 
			"<body>\r\n" + 
			"    <div id=\"map\"></div>\r\n" + 
			"</body>\r\n" + 
			"</html>";
	
	
	Vector locationVector = new Vector();
	

	public routeMap(StringBuffer html, LocationObj source,LocationObj destination) {
		// TODO Auto-generated constructor stub
		
		
		html = html.append(firstPart);
		html.append(secondPart);
		//sourcePoint = "origin: new google.maps.LatLng("+source.getLatitude()+","+source.getLongitude()+"),\r\n";
		html.append("origin: new google.maps.LatLng("+source.getLatitude()+","+source.getLongitude()+"),\r\n");
		//destinationPoint = "destination: new google.maps.LatLng("+destination.getLatitude()+","+destination.getLongitude()+"),\r\n" ;
		html.append("destination: new google.maps.LatLng("+destination.getLatitude()+","+destination.getLongitude()+"),\r\n");
		html.append(thirdPart);
		//centerPoint = "var center = new google.maps.LatLng("+source.getLatitude()+","+source.getLongitude()+");";
		html.append("var center = new google.maps.LatLng("+source.getLatitude()+","+source.getLongitude()+");");
		html.append(finalPart);		
		
	}
	
}

 Regards

RAkesh Shankar.P

Developer
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: Show multiple pin point on google map in blackberry

Hi rakesh

thanks for replying

 

i am testing it into 8520 simulator,but it is showing gray screen only map is not showing for multiple point,

can you tell me why it is,

 

 

but in  device 9300 curve it is showing it is having os 6, and i wanted to check it in simulator 8520 with os 5 is it possible.  

Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Re: Show multiple pin point on google map in blackberry

HI Avinash,

 

By Default JRE(JDE 5.0)will be having the list of devices,you can check using that right?

 

Regards

Rakesh Shankar.P

Trusted Contributor
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
My Carrier: beginner developer

Re: Show multiple pin point on google map in blackberry

I try this code and I obtain an error with this type "LocationObj"

Any one have the same pb?

Contributor
Posts: 23
Registered: ‎05-27-2011
My Device: 9700
My Carrier: Digicel

Re: Show multiple pin point on google map in blackberry

same problem
Developer
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: Show multiple pin point on google map in blackberry

Hi

  here LocationObj is the class ,So first you have to create this class,

any way what error you are getting.

Trusted Contributor
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
My Carrier: beginner developer

Re: Show multiple pin point on google map in blackberry

what should I put in this class  LocationObj???

Developer
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: Show multiple pin point on google map in blackberry

Hi

just put get and set method for latitude and longitude in LocationObj Class.

 

thanks

 

 

if you got the solution click  on like.

Contributor
Posts: 23
Registered: ‎05-27-2011
My Device: 9700
My Carrier: Digicel

Re: Show multiple pin point on google map in blackberry

gonna try this as i reach home..thanks for your prompt response