验证存储权限时如何解决此错误

时间:2017-12-27 08:26:57

标签: java android permissions

image of the error

    public static void verifyStoragePermissions(Activity activity) {
        // Check if we have write permission
        int permission = ActivityCompat.checkSelfPermission(this
                , Manifest.permission.WRITE_EXTERNAL_STORAGE);

        if (permission != PackageManager.PERMISSION_GRANTED) {
            // We don't have permission so prompt the user
            ActivityCompat.requestPermissions(
                    _currentActivity,
                    PERMISSION_STORAGE,
                    MY_PERMISSION_WRITE_STORAGE
            );
        }
    }
}

为什么第一行有错误,括号中的第二个活动是红色下划线

0 个答案:

没有答案