ActivityCompat.requestPermission not showing dialog when called inside onMenuItemClick <p>Hi i´m calling ActivityCompat.requestPermission inside my onMenuItemClick to grant the WRITE_EXTERNAL_STORAGE permission . However , ActivityCompat.requestPermissions is not executed .</p> <p>My target is API 23 </p> <p>I have defined in my manifest </p> <pre><code>&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/&gt; </code></pre> <p>and here is my code which i call inside the onMenuItemClick </p> <pre><code> case R.id.id_captura: if (ContextCompat.checkSelfPermission(ChatActivity.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { dispatchTakePictureIntent(); } else { if (ActivityCompat.shouldShowRequestPermissionRationale(ChatActivity.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) { } else { ActivityCompat.requestPermissions(ChatActivity.this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, WRITE_EXTERNAL_STORAGE_CTE ); } } break; </code></pre> <p>And here is my onRequestPermissionsResult</p> <pre><code>@Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case WRITE_EXTERNAL_STORAGE_CTE: { if (grantResults.length &gt; 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) { dispatchTakePictureIntent(); } else { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this).setTitle("Permissions").setMessage("Permissions not granted ").setPositiveButton("Accept", null); alertDialog.show(); } return ; } } } </code></pre> <p>Aditionally I defined </p> <pre><code>private final int WRITE_EXTERNAL_STORAGE_CTE = 1; </code></pre>