用java显示GPS经度和纬度

时间:2012-02-21 12:36:20

标签: java gps

我想阅读GPS数据流并用java显示经度和纬度。如果可能,我需要一个代码片段或类来执行此操作。

Thanx:)

2 个答案:

答案 0 :(得分:1)

RouteConverter是一个处理许多不同格式的GPS数据的应用程序。有一个没有所有GUI内容的版本可以用作API。

答案 1 :(得分:1)

您可以创建一个实现LocationListener并覆盖onLocationChanged方法的类。

它应该与此类似。

public class abc implements LocationListener {
@override

    public void onLocationChanged(Location location){
        if (location != null) {
        // This needs to stop getting the location data and save the battery power.
            locManager.removeUpdates(locListener); 
            String longitude = "Longitude: " + location.getLongitude();
            String latitude = "Latitude: " + location.getLatitude();
        } 
    }
}
相关问题