title: Application not able to access SD card when WRITE_EXTERNAL_STORAGE permission is granted at run time
body: <p>In <strong>android M</strong>  to access sdcard has to force stop and start app manually when permission is granted at runtime, how to achieve it programmatically?</p>
  
  <p>However sdcard can be accessed if the app is force stop and restarted. </p>
  
  <p>AndroidManifest.xml :</p>
  
  <pre><code>uses-permission-sdk-m android:name="android.permission.WRITE_EXTERNAL_STORAGE
  
  
       /* **Checking permission **
          if doesn't have request
           else
           browse file directory       
      */
  
      String[] perm = { Manifest.permission.WRITE_EXTERNAL_STORAGE };
      if (checkSelfPermission(perm[0]) == PackageManager.PERMISSION_DENIED) {
  
  
                      requestPermissions(perm, REQ);
  
                  } else {
  
                      Explore(); //method to browse file directory
                  }
  </code></pre>
  
  <p><strong>onRequestPermissionsResult</strong></p>
  
  <pre><code>   @Override
  public void onRequestPermissionsResult(int requestCode,
          String[] permissions, int[] grantResults) {
      // TODO Auto-generated method stub
  
      if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {  
  
     //Not able to browse SD card until restart application
  
  
         Explore(); //method to browse file directory
  
  
      } else {
          Log.i("onRequestPermissionsResult", " Request denied");
      }
  
      super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  }
  </code></pre>