private void checkPermission() {
ActivityCompat.requestPermissions(this, new String[] {
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.RECORD_AUDIO
}, REQUEST_CODE);
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (grantResults[0]!=PackageManager.PERMISSION_GRANTED ||
grantResults[1]!=PackageManager.PERMISSION_GRANTED ||
grantResults[2]!=PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, "请打开设置允许相关权限!", Toast.LENGTH_SHORT).show();
}
}