title: onRequestPermissionsResult not being called in dialog fragment
body: <p>I have started to work on Android M runtime permission. Here I am facing the issue that if <code>requestPermissions</code> is called from <code>Dialog Fragment</code> class then <code>onRequestPermissionsResult</code> not getting called in the same <code>Dialog fragment</code> class. But if <code>requestPermissions</code> is called from <code>Activity</code> class or <code>Fragment</code> class then <code>onRequestPermissionsResult</code> method get called in the same class. </p>
  
  <p>Here is my sample code:</p>
  
  <pre><code>public class ContactPickerDialog extends DialogFragment {
      private static final int READ_CONTACTS_REQUEST_CODE = 12;
      private Context mContext;
  
      private void loadContact() {
          if(hasPermission(mContext, Manifest.permission.READ_CONTACTS)){
              new ContactSyncTask().execute();
          } else {
              this.requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, READ_CONTACTS_REQUEST_CODE);
          }
      }
  
      @Override
      public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
          Logger.d("TAG", "dialog onRequestPermissionsResult");
          switch (requestCode) {
              case READ_CONTACTS_REQUEST_CODE:
                  // Check Permissions Granted or not
                  if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                      new ContactSyncTask().execute();
                  } else {
                      // Permission Denied
                      Toast.makeText(getActivity(), "Read contact permission is denied", Toast.LENGTH_SHORT).show();
                  }
              break;
              default:
                  super.onRequestPermissionsResult(requestCode, permissions, grantResults);
          }
      }
  
      private static boolean hasPermission(Context context, String permission){
          return ContextCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED;
      }
  
  } 
  </code></pre>
  
  <p>Here in the code I am calling <code>requestPermissions</code> method of <code>Dialog Fragment</code> class. So I am expecting to get result in same class.</p>
  
  <p>Any help is appreciated. Thanks in advance!</p>
  
  <hr>
  
  <p><strong>EDIT:</strong>
  Here I am adding more detail, so that it will be more helpful to others.
  Previously I have used getChildFragmentManager() to show the DialogFragment.</p>
  
  <pre><code>ContactPickerDialog dialog = new ContactPickerDialog();
  dialog.show(getChildFragmentManager(), "Contact Picker");
  </code></pre>
  
  <p>But As <strong>@CommonWare</strong> asked me to use activity to show the DialogFragment. I have made following changes and it works.</p>
  
  <pre><code>ContactPickerDialog dialog = new ContactPickerDialog();
  dialog.show(getActivity().getSupportFragmentManager(), "Contact Picker");
  </code></pre>