Previously, I created a class that extends GeoPoint in Android Map API v1:
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;
}
}
Now I am switching to V2, what should I extend? Should it be LatLng? But when I switch to LatLng, it says: The type CyclePoint cannot subclass the final class LatLng. Can anyone help me with this? Thanks so much!
The LatLng object! http://developer.android.com/reference/com/google/android/gms/maps/model/LatLng.html
this object is very useful! u just have to create a instance
ex:
LatLng home = new LatLng(-34.3232,-8.31331); // instanciate a new Latlng
home.getLatitude(); // get latitude
home.getLongitude(); // get longitude
ps: Latitude and Longitude have to be double type.
Use composition instead of inheritance, i.e. make LatLng a field in your CyclePoint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With