title: Code Returns from If(ActivityCompat.checkSelfPermission) segment
body: <p>Hello Everyone I am creating Navigation Application using Android Studio and getting this error while doing.
  My Code Stops in <code>if(ActivityCompat.checkSelfPermission)</code> segment. Here i have toast statement. I have already provided <code>COARSE_LOCATION</code>, <code>FINE_LOCATION</code> and <code>INTERNET</code> permission in AndroidManifest file.
  Following code given.</p>
  
  <pre><code>    public class Second extends Activity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
  //Declaring Class Objects
  Location location;
  LocationManager lm;
  GoogleApiClient googleApiClient;
  //Data type for storing value of Longitude and Latitude
  private double fromLongitude;
  private double fromLatitude;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.second);
      googleApiClient = new GoogleApiClient.Builder(this).addApi(LocationServices.API).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();
      getLocation();
  }
  
  private void getLocation() {
      if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
          // TODO: Consider calling
          //    ActivityCompat#requestPermissions
          // here to request the missing permissions, and then overriding
          //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
          //                                          int[] grantResults)
          // to handle the case where the user grants the permission. See the documentation
          // for ActivityCompat#requestPermissions for more details.
  
          Toast.makeText(this,"Issue with permission",Toast.LENGTH_LONG).show();
          return;
      }
      Location location = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
      fromLatitude = location.getLatitude();
      fromLongitude = location.getLongitude();
      Toast.makeText(this,String.valueOf(fromLatitude)+" "+String.valueOf(fromLongitude),Toast.LENGTH_LONG).show();
  }
  
  //Starting Google API Client
  
  @Override
  protected void onStart() {
      googleApiClient.connect();
      super.onStart();
  }
  
  //Stopping Google API Client
  @Override
  protected void onStop() {
      googleApiClient.disconnect();
      super.onStop();
  }
  
  @Override
  public void onConnected(Bundle bundle) {
  
  }
  
  @Override
  public void onConnectionSuspended(int i) {
  
  }
  
  @Override
  public void onConnectionFailed(ConnectionResult connectionResult) {
  
  }
  }
  </code></pre>
  
  <p>This prints <code>"Issue with Permission"</code>, that i have toast in if segment.</p>