title: TextFields not updating
body: <p>New to android development and been trying to follow a tutorial for a gps location app in android studio, but for some reason the text field are not updating.</p>
  <p>Here is the tutorial i have been following :-
  [<a href="https://www.youtube.com/watch?v=_xUcYfbtfsI" rel="nofollow noreferrer">Android Studio Tutorial - Build a GPS App</a>]<a href="https://www.youtube.com/watch?v=_xUcYfbtfsI" rel="nofollow noreferrer">1</a></p>
  <p>...................................................................................................................................................................................................................................................................
  Here is the code :-</p>
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  TextView longi,lat;
  Switch share;
  
  // google play service api
  FusedLocationProviderClient fusedLocationProviderClient;
  // location request service
  LocationRequest locationRequest;
  private static final int sETINTERVAL=30;
  private static final int fASTESTINTERVAL=5;
  public static final int rEQUESTCODE=1;
  
  @RequiresApi(api = Build.VERSION_CODES.M)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      longi = findViewById(R.id.longi);
      lat   = findViewById(R.id.lat);
      share = findViewById(R.id.share);
  
      locationRequest = LocationRequest.create();
  
      locationRequest.setInterval(1000 * sETINTERVAL);
      locationRequest.setFastestInterval(1000 * fASTESTINTERVAL);
      locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
  
      share.setOnClickListener(v -&gt; {
          if(share.isChecked()){
              share.setText(&quot;ON&quot;);
              updateGPS();
          }
          else{
              share.setText(&quot;OFF&quot;);
          }
      });
  }
  
  @RequiresApi(api = Build.VERSION_CODES.M)
  @Override
  public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
      super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  
      switch (requestCode){
          case rEQUESTCODE:
              if(grantResults[0] == PackageManager.PERMISSION_GRANTED){
                  updateGPS();
              }
              else{
                  Toast.makeText(this, &quot;Requires location permission&quot;, Toast.LENGTH_SHORT).show();
                  finish();
              }
              break;
          default:
              throw new IllegalStateException(&quot;Unexpected value: &quot; + requestCode);
      };
  }
  
  
  @RequiresApi(api = Build.VERSION_CODES.M)
  private void updateGPS(){
      fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(MainActivity.this);
  
      if(ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){
          fusedLocationProviderClient.getLastLocation().addOnSuccessListener(this, new OnSuccessListener&lt;Location&gt;() {
              @Override
              public void onSuccess(Location location) {
                  updateUI(location);
              }
          });
      }
      else{
          requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION},rEQUESTCODE);
      }
  }
  
  private void updateUI(Location location){
      lat.setText(String.valueOf(location.getLatitude()));
      longi.setText(String.valueOf(location.getLongitude()));
  }
  </code></pre>
  <p>}</p>