to Location String - Android Map

Android examples for Map:Location String

Description

to Location String

Demo Code


//package com.java2s;
import android.location.Location;

public class Main {
    public static String toLocationString(double latitude, double longitude) {
        return Location.convert(latitude, Location.FORMAT_DEGREES) + ","
                + Location.convert(longitude, Location.FORMAT_DEGREES);
    }//  w  ww.  java2 s  .  co m

    public static String toLocationString(Location location) {
        return Location.convert(location.getLatitude(),
                Location.FORMAT_DEGREES)
                + ","
                + Location.convert(location.getLongitude(),
                        Location.FORMAT_DEGREES);
    }
}

Related Tutorials