title: Permission request dialog box appearing multiple times android
body: <p>Check permission dialog box appears again and again inspite of giving permission and clicking all dialog box as accept it closes the app.</p>
  
  <p>I have a helper method to check multiple permissions and see if any of them are not granted.</p>
  
  <pre><code>            public static boolean hasPermissions(Context context, String... permissions) {
          if (android.os.Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M &amp;&amp; context != null &amp;&amp; permissions != null) {
              for (String permission : permissions) {
                  if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
                      return false;
                  }
              }
          }
          return true;
      }
   int PERMISSION_ALL = 1;
  
           String[] PERMISSIONS = {Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.CAMERA};
         if(!hasPermissions(this, PERMISSIONS)){
              Log.d("permission","permission");
              ActivityCompat.requestPermissions(this, PERMISSIONS, PERMISSION_ALL);
  
          }
  </code></pre>
  
  <p>I want it to load the same activity i.e. the MainActivity after granting permission. </p>
  
  <p>Can anyone point why the permission is being asked multiple times.</p>