To convert decimals to degrees, you can do it as follows
String strLongitude = Location.convert(location.getLongitude(), Location.FORMAT_DEGREES); String strLatitude = Location.convert(location.getLatitude(), Location.FORMAT_DEGREES);
Link to the Android developer site .
Edit
I tried the following thing and get the output:
strLongitude = Location.convert(location.getLongitude(), Location.FORMAT_DEGREES); strLatitude = Location.convert(location.getLatitude(), Location.FORMAT_DEGREES); OUTPUT : Long: 73.16584: Lat: 22.29924 strLongitude = Location.convert(location.getLongitude(), Location.FORMAT_SECONDS); strLatitude = Location.convert(location.getLatitude(), Location.FORMAT_SECONDS); OUTPUT : Long: 73:9:57.03876: Lat: 22:17:57.26472 strLongitude = Location.convert(location.getLongitude(), Location.FORMAT_MINUTES); strLatitude = Location.convert(location.getLatitude(), Location.FORMAT_MINUTES); OUTPUT : Long: 73:9.95065: Lat: 22:17.95441
Try another option as per your requirement.
dinesh sharma
source share