olá…
estou começando agora em java e não tenho muita experiência…
e tenho um código que está como aplicativo java e quero passar o código dele como aplicativo móvel…
tenho 3 class…
A classe GeoCoordinate…
import java.io.Serializable;
public class GeoCoordinate implements Serializable, Cloneable {
private static final long serialVersionUID = 201009101110L;
private double latitude;
private double longitude;
public GeoCoordinate(double latitude, double longitude) {
super();
this.latitude = latitude;
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double distanceInKm(GeoCoordinate coordinate) {
return GeoUtils.geoDistanceInKm(this, coordinate);
}
protected Object clone() throws CloneNotSupportedException {
return new GeoCoordinate(this.getLatitude(), this.getLatitude());
}
public int hashCode() {
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(latitude);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(longitude);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
GeoCoordinate other = (GeoCoordinate) obj;
if (Double.doubleToLongBits(latitude) != Double
.doubleToLongBits(other.latitude))
return false;
if (Double.doubleToLongBits(longitude) != Double
.doubleToLongBits(other.longitude))
return false;
return true;
}
}
A classe GeoUtils…
public class GeoUtils {
public static int EARTH_RADIUS_KM = 6371;
public static double geoDistanceInKm(double firstLatitude,
double firstLongitude, double secondLatitude, double secondLongitude) {
double firstLatToRad = Math.toRadians(firstLatitude);
double secondLatToRad = Math.toRadians(secondLatitude);
double deltaLongitudeInRad = Math.toRadians(secondLongitude
- firstLongitude);
return Math.acos(Math.cos(firstLatToRad) * Math.cos(secondLatToRad)
* Math.cos(deltaLongitudeInRad) + Math.sin(firstLatToRad)
* Math.sin(secondLatToRad))
* EARTH_RADIUS_KM;
}
public static double geoDistanceInKm(GeoCoordinate first,
GeoCoordinate second) {
return geoDistanceInKm(first.getLatitude(), first.getLongitude(),
second.getLatitude(), second.getLongitude());
}
}
e tenho uma outra classe que apenas chama o que eu quero…
aparecem erros nas minhas classes GeoUtils e GeoCoordinate…
agradeço se puderem ajudar…