title: onRequestPermissionsResult callback must wait method call requestPermissions finish
body: <p>i'm trying to get result of a requestPermissions(..) by using a sleep loop and wait for user response, but the callback method onRequestPermissionsResult(..) must wait for the method which call requestPermissions finish to execute, so I cant get it as well.</p>
  
  <p>Example code :</p>
  
  <pre><code>public int result = 0;
  
  public int askSystemForPermission(String permission)
  {
     result = 0;
     requestPermissions(this,new String[] {permission});
  
     while (result == 0)                  // It hang forever here
     {                                    // because onRequestPermissionsResult never excute
        try {                             // then result always equals to 0
            Thread.sleep(500);
        } catch (Exception ecx) {}
     }
  
     return result;
  }
  
  
  public void onRequestPermissionsResult(...)
  {
     if ( /*granted*/ )
     {
         result = 1;
     }
     else if ( /*dont show again*/ )
     {
         result = 2;
     }
     else //denied
     {
         result = 3;
     }
  }
  </code></pre>
  
  <p>I've tried some solution :
  Put requestPermissions in new Thread(), runOnUiThread() .. still the same.
  Call requestPermissions from other Activity, the new Activity dont even start, it still wait askSystemForPermission method finish.</p>
  
  <p>P/S : It can be done in others way but i want to know why android act like this and how to resolve this problem.</p>