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 

Rakesh 

many many thanks to you for my help

your code is working fine. :-)

Regular Contributor
Posts: 70
Registered: ‎12-19-2011
My Device: Bold 9780
My Carrier: Airtel

Re: Show multiple pin point on google map in blackberry

Hi rakesh86

     I need to implement the multiple pin on blackberry map.I want to use this code.I want to ask you the following:

1: What is locationObj in the following.Is it a class that extends Location.

MultiplePoints(StringBuffer html,Vector waypoints,LocationObj center)

 

2: I just had to give this html in BrowserField

3: the vector waypoints contains the name of the location like(Delhi).

3: What the other changes i need to do for this to execute successfully.

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

if the same thing i want to do on os 5 for that what i have to please let me know .

 

thanks

regard avinash

Regular Contributor
Posts: 70
Registered: ‎12-19-2011
My Device: Bold 9780
My Carrier: Airtel

Re: Show multiple pin point on google map in blackberry

Hi avinash

     plz tell me how you run the above code.

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

this is my code use os 6 to see the correct out put

thanks

 

package map;
import java.util.Vector;

import net.rim.blackberry.api.browser.Browser;
import net.rim.blackberry.api.browser.BrowserSession;
import net.rim.device.api.browser.field2.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.*;

public class NewBrowserFieldDemo extends UiApplication
{
    public static void main(String[] args)
    {
        BrowserFieldDemo app = new BrowserFieldDemo();
        app.enterEventDispatcher();
    }
    public NewBrowserFieldDemo()
    {
        pushScreen(new MultiplePoints());
    }
}



    
         class MultiplePoints extends MainScreen{
            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: 500px; height: 400px;\"></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>";
            String[] lt={"12.966085","12.944337","12.925599"};
          String[] lon={"77.533264","77.549400","77.594719"};
          String[] name={"vijyanagar","Banashankari","jaynagar"};
            MultiplePoints(){//StringBuffer html,Vector waypoints,LocationObj center){
                StringBuffer html=new StringBuffer();
                html.append(initial);        
                for(int i=0 ; i<lt.length; i++){
                    //LocationObj source = (LocationObj)waypoints.elementAt(i);
                    //String point = "['"+source.getLabel()+"',"+source.getLatitude()+","+ source.getLongitude()+","+i+"],";
                    String point = "['"+name[i]+"',"+lt[i]+","+ lon[i]+","+i+"],";
                    //System.out.println("Point is"+point);
                    html.append(point);
                }
                html.append(second);
                centerPoint = "  center: new google.maps.LatLng("+lt[0]+","+lon[0]+"),";    
                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.requestContent("localhost://D:/Avinash/google.html");
              myBrowserField.displayContent(html.toString(), "http://localhost");
              HorizontalFieldManager horf=new HorizontalFieldManager(HORIZONTAL_SCROLL);
              horf.add(myBrowserField);
              add(horf);
            }
        }


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

Re: Show multiple pin point on google map in blackberry

Hi Avinash,

 

I found some problem especiallly you will not be getting root maps for 5.0 (Java script is not supporting fully) .But i think,it will show multiple points in 5.0 Os and above.

 

Regards

 

 

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

is there any other way(except javascript) to access google map for os 5.

 

thanks

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

Re: Show multiple pin point on google map in blackberry

What is the problem you are facing while using java script for 5.0 OS?

 

Regards

Rakesh Shankar.P

Developer
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: Show multiple pin point on google map in blackberry

Hi All,
Is this about Google static maps or dynamic maps?
If it is static maps , if maps are not installed in device then what should I do,Suppose if i want dynamic maps then what are the ways in front of me,
Help me!
Thanks in advance.
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

actually i am not having device with os 5 to check it i am having only os 6

and in simulator map is not displaying only dark screen it is showing,

but in os 6 it is working fine that why i asked for other way to use in os 5