First of all I'm a complete noob to android. Going step by step on my first app and facing some problems.
- I can get my location in terms of Lat and Lon and now i have to save it to file and able to read the file to compare location in future. Could anybody please help me out on this can be done.
Following is my INCORRECT CODE
public void saveCurrentLocation(Location location){
SharedPreferences prefs = this.getSharedPreferences("com.example.mylocation", Context.MODE_PRIVATE);
String currentLat = "com.example.mylocation.location";
String now = prefs.getString(currentLat, location.getLatitude());
}
Error shown is that location.getLatitude is a double and cannot be saved to string (quite obvious but not sure how to change it)
Thanks