我正在尝试在我的应用包上的内部存储上创建文件夹调试显示它已成功创建但当我检查手机时没有文件夹 已经尝试了一切,没有任何工作
getFilesDir();
Enviroment.getDataDirectory();
我的方法
private String createPath() {
if (Environment.getExternalStorageState() == null) {
//create new file directory object
File directory = new File(getContext().getFilesDir(),"Images");
// if no directory exists, create new directory
if (!directory.exists()) {
directory.mkdir();
}
Log.e("path", directory.getPath());
return directory.getPath();
// if phone DOES have sd card
} else if (Environment.getExternalStorageState() != null) {
// search for directory on SD card
File directory = new File(Environment.getExternalStorageDirectory() + "/InstaDown/" + "Images");
// if no directory exists, create new directory to store test
// results
if (!directory.exists()) {
directory.mkdir();
}
Log.e("path", directory.getPath());
return directory.getPath();
}// end of SD card checking
return null;
}
注意:外部存储正在运行