美文网首页
FileNotFoundException

FileNotFoundException

作者: 听说萝莉很可爱 | 来源:发表于2017-10-09 16:28 被阅读13次

java.io.FileNotFoundException: /storage/emulated/0/scds/selectPerson.txt (Permission denied)

    //获取权限
    int REQUEST_EXTERNAL_STORAGE = 1;
    String[] PERMISSIONS_STORAGE = {
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.WRITE_EXTERNAL_STORAGE
    };
    int permission = ActivityCompat.checkSelfPermission(GlobalVar.getInstance().getApplicationContext()
            , Manifest.permission.WRITE_EXTERNAL_STORAGE);
    if (permission != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(activity,
                PERMISSIONS_STORAGE,
                REQUEST_EXTERNAL_STORAGE
        );
    }

相关文章

网友评论

      本文标题:FileNotFoundException

      本文链接:https://www.haomeiwen.com/subject/kajpyxtx.html