android - Android Google Map API V2 中对应的地理点是什么?

标签 android google-maps-android-api-2

之前,我在 Android Map API v1 中创建了一个扩展 GeoPoint 的类:

class CyclePoint extends GeoPoint {
    public float accuracy;
    public double altitude;
    public float speed;
    public double time;

    public CyclePoint(int lat, int lgt, double currentTime) {
        super(lat, lgt);
        this.time = currentTime;
    }

    public CyclePoint(int lat, int lgt, double currentTime, float accuracy) {
        super(lat, lgt);
        this.time = currentTime;
        this.accuracy = accuracy;
    }

    public CyclePoint(int lat, int lgt, double currentTime, float accuracy, double altitude, float speed) {
    super(lat, lgt);
    this.time = currentTime;
    this.accuracy = accuracy;
    this.altitude = altitude;
    this.speed = speed;
    }
}

现在我正在切换到 V2,我应该扩展什么?应该是 LatLng 吗?但是当我切换到 LatLng 时,它说:类型 CyclePoint 不能子类化最终类 LatLng。谁能帮我这个?非常感谢!

最佳答案

LatLng 对象! http://developer.android.com/reference/com/google/android/gms/maps/model/LatLng.html

这个对象非常有用! 你只需要创建一个实例

ex:
    LatLng home = new LatLng(-34.3232,-8.31331); // instanciate a new Latlng
    home.getLatitude();  // get latitude
    home.getLongitude(); // get longitude

ps:纬度和经度必须是double类型。

关于android - Android Google Map API V2 中对应的地理点是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19690083/

相关文章:

android - 很难使用 android maven 插件运行 Proguard 来混淆 apklib

android - 使用 Retrofit 解析动态 key Json 字符串

android - 自定义 RecyclerViewAdapter 中的 MapView

android - 如何在不同的信息窗口显示不同的图片

google-maps-android-api-2 - Google Play 服务已过时。需要 4030500 但找到 3265136

android - Google Maps v2 - 如何在 infowindowadapter 中填充两个以上的 TextView?

android - 找不到对象上的参数 [文件集合] 的方法 compile()

java - "class loading deadlock"在这里是什么意思?

android - 完全关闭自动曝光补偿?

android - 如何在 fragment 中使用谷歌地图 V2?