In my oncreate method I have the following
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_WRITE_PERMISSION);}
The issue is that the next line of code has to do with adjusting the UI based on reading from the external storage.I gather that the dialog for requesting permission is running asynchronously and you dont get a chance to grant permission before it runs the next line of code.
Is there a way of saying "dont run another line of code before the user makes a choice regarding granting permission"?
No, you should always wait for the callback to
onRequestPermissionsResult
if you need to know if the permission can been granted or not as per the Requesting Permissions at run time training.