/** * Report location updates to the UI. * * @param location The updated location. */ @Override public void onLocationChanged(Location location) { // Report to the UI that the location was updated mConnectionStatus.setText(R.string.location_updated); // In the UI, set the latitude and longitude to the value received mLatLng.setText(LocationUtils.getLatLng(this, location)); }
/** * Invoked by the "Get Location" button. * * <p>Calls getLastLocation() to get the current location * * @param v The view object associated with this method, in this case a Button. */ public void getLocation(View v) { // If Google Play Services is available if (servicesConnected()) { // Get the current location Location currentLocation = mLocationClient.getLastLocation(); // Display the current location in the UI mLatLng.setText(LocationUtils.getLatLng(this, currentLocation)); } }