2013-10-30 57 views
5

以前,我創建了Android中地圖API V1擴展的GeoPoint類:什麼對應於Android Google Map API V2中的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。誰能幫我這個?非常感謝!

回答

3

使用組合而不是繼承,即在CyclePoint中使LatLng成爲一個字段。

+0

謝謝,我只是使用int緯度,經度,它的工作。 GeoPoint對這個沒有用處。 – Anhong

相關問題