You have activity running LocationListener
implements LocationListener
then request locationUpdates inside your onCreate
lm.requestLocationUpdates(provider, 20000, 0, this);
then in the onLocationChanged method that you override to implement the LocationListener, update your text elements after sending the location
@Override
public void onLocationChanged(Location location) {
double lng = location.getLongitude();
double lat = location.getLatitude();
ln.setText("" + lng);
lt.setText("" + lat);
}
source
share