之前,我在 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/