Cast double to string

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Cast double to string

Postby rd42 » Mon Apr 12, 2010 4:11 pm

getLongitude is a double, addToGPSLog wants a string, is there a way to cast getLongitude to a string in that same line?
Code: Select all
addToGPSLog(location.getLongitude());
User avatar
rd42
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Apr 01, 2010 5:12 pm

Top

Postby dalf » Mon Apr 12, 2010 7:09 pm

I think you can find this solution with Google...
You can do:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. String myString = new Double(location.getLongitude()).toString();
  2.  
  3. addToGPSLog(myString);
  4.  
  5.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

or maybe
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. addToGPSLog(location.getLongitude() + "");
Parsed in 0.030 seconds, using GeSHi 1.0.8.4



Dalf
dalf
Junior Developer
Junior Developer
 
Posts: 17
Joined: Wed Mar 10, 2010 4:23 am

Postby rd42 » Mon Apr 12, 2010 7:15 pm

Thanks.
User avatar
rd42
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Apr 01, 2010 5:12 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests