1if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
2 Dexter.withContext(getApplicationContext()).withPermission(Manifest.permission.READ_EXTERNAL_STORAGE).withListener(new PermissionListener() {
3 @Override
4 public void onPermissionGranted(PermissionGrantedResponse permissionGrantedResponse) {
5
6 }
7
8 @Override
9 public void onPermissionDenied(PermissionDeniedResponse permissionDeniedResponse) {
10 Toast.makeText(getApplicationContext(), "We can't continue without Permission", Toast.LENGTH_SHORT).show();
11 }
12
13 @Override
14 public void onPermissionRationaleShouldBeShown(PermissionRequest permissionRequest, PermissionToken permissionToken) {
15 permissionToken.continuePermissionRequest();
16 }
17 }).check();
18 }