我无法删除存储空间中的文件夹。这是我的代码
File dir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/sdcard/folder" );
if (dir.isDirectory())
{
String[] children = dir.list();
for (int i = 0; i < children.length; i++)
{
new File(dir, children[i]).delete();
}
}
答案 0 :(得分:0)
这就是你如何做到的
但首先你需要在清单中拥有此权限
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
然后
File dir = new File(Environment.getExternalStorageDirectory()+"/sdcard/folder");
if (dir.isDirectory())
{
String[] children = dir.list();
for (int i = 0; i < children.length; i++)
{
new File(dir, children[i]).delete();
}
}