我知道类似的问题已经在这里问了很多,但我找不到适合我的答案。
我有一个 File 对象,它有一个指向 SD 卡(外部存储)的路径。例如:
File selectedFile = new File("/storage/emulated/0/Pictures/Screenshots/Screenshot_20160725-185624.png");
我现在要做的是将该图像/视频保存到我的应用程序内部存储的子文件夹中。
例如,将文件保存到此处:INTERNAL_STORAGE/20/public_gallery/300.png
我遇到的问题是当我使用
outputStream = context.openFileOutput("20/public_gallery/300.png", Context.MODE_PRIVATE);
...
outputStream.write(content.getBytes());
...
我不能对子文件夹使用任何“/”。
如果有人能给我一个小代码示例,我将非常感激。