I don't get latitute and logitude : **"Actually I don't get latitude and longitude from this code.Help me anyone to solve my problem."**
 

   

  

  

    package com.example.reyadmahabub.location;
        
        import android.Manifest;
        import android.content.pm.PackageManager;
        import android.location.Location;
        import android.support.v4.app.ActivityCompat;
        import android.support.v7.app.AppCompatActivity;
        import android.os.Bundle;
        import android.widget.Toast;
    
  

 

 

    import com.google.android.gms.location.FusedLocationProviderClient;
    import com.google.android.gms.location.LocationCallback;
    import com.google.android.gms.location.LocationRequest;
    import com.google.android.gms.location.LocationResult;
    import com.google.android.gms.location.LocationServices;

    public class MainActivity extends AppCompatActivity {
        private LocationCallback callback;
        private LocationRequest request;
        private FusedLocationProviderClient client;
    
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate( savedInstanceState );
            setContentView( R.layout.activity_main );
            client = LocationServices.getFusedLocationProviderClient( this );
            callback = new LocationCallback() {
                @Override
                public void onLocationResult(LocationResult locationResult) {
                    super.onLocationResult( locationResult );
                    for (Location location:locationResult.getLocations()){
                        double lat=location.getLatitude();
                        double lon=location.getLongitude();
                        Toast.makeText( MainActivity.this,lat+","+lon, 

   

     Toast.LENGTH_SHORT ).show();
                        }
        
                    }
                };
                createLocationRequest();
    
    
        }
    
   

     private void createLocationRequest() {
            request = new 

    LocationRequest().setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY )
                        .setInterval( 2500 ).setFastestInterval( 5000 );
    
       

 if (ActivityCompat.checkSelfPermission( this, Manifest.permission.ACCESS_FINE_LOCATION ) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission( this, Manifest.permission.ACCESS_COARSE_LOCATION ) != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions( this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_COARSE_LOCATION},1 );
            return;
            }

   

     client.requestLocati onUpdates( request, callback, null );
        }
    }

