title: StartActivity once user click Allow on Permission Screen
body: <p>My one activity need Location Permission and I wrote below code to get permission. But in this case user need to click twice to open activity if app does not have location permission initially. Can I make some change so that once user click allow on Permission screen, only then intent fires.</p>
  
  <pre><code> int PERMISSION_ALL = 1;
                              String[] PERMISSIONS = new String[0];
                              if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) {
                                  PERMISSIONS = new String[]{
                                          Manifest.permission.ACCESS_FINE_LOCATION};
                              }
  
                              if (!hasPermissions(getApplicationContext(), PERMISSIONS)) {
                                  ActivityCompat.requestPermissions(StartupActivity.this, PERMISSIONS, PERMISSION_ALL);
                              }
  
                              if (hasPermissions(getApplicationContext(), PERMISSIONS)) {
                                  new Thread(new Runnable() {
                                      @Override
                                      public void run() {
                                          Intent intent = new Intent(StartActivity.this, Details.class);
                                          startActivity(intent);
                                      }
                                  }).start();
                              }
  </code></pre>