我以编程方式创建了一个目录并插入了照片:
File dirGallery = context.getDir("Gallery", Context.MODE_PRIVATE);
File fileWithinMyDir = new File(dirGallery, photo);
...
这是有效的!
但现在我想在我现有的目录“画廊”中创建一个目录并插入其他照片。我试过了 :
File dirGallery = context.getDir("Gallery/Gallery2", Context.MODE_PRIVATE);
但我得到“文件...包含路径分隔符”。
我也试过:
File dirGallery = context.getDir("Gallery", Context.MODE_PRIVATE);
dirGallery.mkdir();
File dirGallery2 = new File(dirGallery,"Gallery2");
dirGallery2.mkdir();
File fileWithinMyDir = new File(dirGallery2, nomPhoto);
当我得到我的文件时:
File dirGallery = context.getDir("Gallery", Context.MODE_PRIVATE);
File dirGallery2 = new File(dirGallery,"Gallery2");
File[] listImages = dirGallery2.listFiles(filter);
但是 listImages 是空的。我在哪里失败了?
泰