I have setup the code for fetching the gps location of the device when
the device's location changes. But I want to save this location on a
file or send this location information to my webserver.
I tried creating a class with setter and getter methods but its not
storing the info. When I run the app, it closes with unxpected error.
Note: I have declared myLocation as public in the main function.
I could write the location on to a file. Now I tried sending the
location information through a socket but the app crashed.
Could you please tell me if that's possible.
Thanks,
raqz
- Code: Select all
public class MyLocation{
private double latitude;
private double longitude;
private long time;
public MyLocation(double latitude, double longitude, long time) {
this.latitude = latitude;
this.longitude = longitude;
this.time = time;
}
public double giveMyLatitude(){
return (latitude);
}
public double giveMyLongitude(){
return (longitude);
}
public double giveMyTime(){
return (time);
}
- Code: Select all
public void onLocationChanged(Location arg0) {
Toast.LENGTH_SHORT).show();
myLocation = new
MyLocation(arg0.getLatitude(),arg0.getLongitude(),arg0.getTime());
GeoPoint p = new GeoPoint((int) (arg0.getLatitude()*1E6),(int)
(arg0.getLongitude()*1E6));
mc.animateTo(p);
mc.setZoom(16);
mapView.invalidate();


