Q:

Get current coordinates

Im writing an application that supposed to send coordinates in an SMS, but I've been struggling a bit with understanding how to get the coordinates. 
At the moment I'm using this 
  LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
  Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
  longitude = location.getLongitude();
  latitude = location.getLatitude();

And then i pass the long and lat into the text, but this only gives me the last know location i guess? 
Can anyone tell me how to get the current location?
Regards
/Fred

A:

you need to create a LocationListener and pass it to the LocationManager like this: locationManager.requestLocationUpdates(
                locationManager.getBestProvider(fine, true),
                minTime, 0, listenerFine);
You will get your lat/long updates from the listener in onLocationChanged() 

