stuart-d2
3/26/2014 - 11:58 PM

LocationManager : location , locationListener

LocationManager : location , locationListener

public void getLocationClicked(View aView) {
		// Acquire a reference to the system Location Manager
		final LocationManager locationManager = (LocationManager) this
				.getSystemService(Context.LOCATION_SERVICE);

		// Define a listener that responds to location updates
		LocationListener locationListener = new LocationListener() {
			public void onLocationChanged(Location location) {
				// Called when a new location is found by the network location
				// provider.

				Toast.makeText(getApplicationContext(),
						"New Location obtained.", Toast.LENGTH_LONG).show();
				makeUseOfNewLocation(location);
				locationManager.removeUpdates(this);

			}