2013-10-30 10 views
5

Früher habe ich eine Klasse, die GeoPoint in Android Map API v1 erweitert:Was entspricht Geopoint in Android Google Map API V2?

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; 
    } 
} 

Jetzt bin ich die Umstellung auf V2, was soll ich verlängern? Sollte es LatLng sein? Aber wenn ich zu LatLng wechsle, heißt es: Der Typ CyclePoint kann die letzte Klasse LatLng nicht ableiten. Kann mir jemand dabei helfen? Vielen Dank!

Antwort

3

Verwenden Sie die Komposition statt der Vererbung, d. H. Machen Sie LatLng ein Feld in Ihrem CyclePoint.

+0

Danke, ich benutze einfach int Breite, Länge und es hat funktioniert. Die GeoPoint-Sache ist für diesen nicht nützlich. – Anhong

Verwandte Themen