Solved by adding this code:
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},1);
After going over many posts about this, I'm still not able to solve the error.
Error: Permission Denied. (When saving a photo)
I'm using this code to see if the permission is granted, and it's not granted.
int result = ContextCompat.checkSelfPermission(ClassifierActivity.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (result == PackageManager.PERMISSION_GRANTED){
Toast.makeText(ClassifierActivity.this, "Permission granted..", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(ClassifierActivity.this, "Permission NOT granted..", Toast.LENGTH_SHORT).show();
}
I've added this code to the Manifest (and it doesn't work):
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Solved by adding this code:
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},1);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.