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

BlackBerry® World™ Development

New Developer
Posts: 134
Registered: ‎01-11-2011
My Device: curve

Problem with latitude and longitude

Hi all

         I am developing an application on blackberry.In my app i got the value of Latitude and Longitude from the server.Now i have to show this location on the Map.

my code is following:



        MapView mapView = new MapView();
        MapsArguments mapsArgs = new MapsArguments(mapView);
        Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, mapsArgs);

the problem is I have the value of latitude and longitude as double data type from the server

but the method takes as int b'coz of this it don't show the location on map.

how i can set the value of latitude and longitude as double.

Posts: 80
Registered: ‎11-25-2010
My Device: 9700
My Carrier: Rogers

Re: Problem with latitude and longitude

I'm guessing the variables 'latitude' and 'longitude' are strings pulled from the server, in the form of "00.00000"


Also, note that when you set the latitude or longitude in MapView, it should be 100000 times the decimal lat or long.


Try something like this:


double lat_dbl = Double.parseDouble(latitude) * 100000;
double long_dbl = Double.parseDouble(longitude) * 100000;
int lat_int = (int)lat_dbl;
int long_int = (int)long_dbl;



If my post helped you, make sure to give me kudos by clicking the star below my name! Smiley Happy