Create a read-only folder in sdcard in android

前端 未结 5 1687
无人共我
无人共我 2020-12-21 19:14

I want to create a folder in sdcard in an android device and I want to set a folder permission for the creating folder. The folder permission should be that from only from m

5条回答
  •  没有蜡笔的小新
    2020-12-21 19:39

    as others have said, you can't for the reasons specified.

    i'm not exactly sure what you are trying to accomplish, but if you want to create a private file that can't be accessed by other apps, you can create in your app's "data" directory, by doing this,

    OutputStream os = context.createFileOutput("myfile.ext", Context.MODE_PRIVATE);
    

    note that this is not the SD card, it's internal storage, so you aren't going to be able to create a very large file.

提交回复
热议问题