为什么这段代码不起作用:S
public void delete(String name) {
File file = new File(
activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES),
name);
if (file.exists()) {
String[] files = file.list();
for (int i = 0; i < files.length; i++) {
boolean deleted;
if (new File(files[i]).isDirectory())
delete(new File(files[i]).getName());
else {
deleted = new File(files[i]).delete();
Log.d(new File(files[i]).getName(),
Boolean.toString(deleted));
}
}
}
}
我正在使用许可
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
当我检查删除的值时,我发现它是错误的:S