我正在检查目录中是否存在文件。如果没有,它应该下载它。
    File file = new File(mediadir, _name);
    if(file.exists()) {
        Log.i("FILE EXISTS", _name);
    } else {
        Log.i("DOWNLOAD", _name);
        new Download().execute(context, name, "http://192.168.2.136:8080/rest/transfer/"+ linkid +"/"+ username +"/" + json_data.getString("ID"));
}
但是file.exists()总是正确的
该文件在那里不存在
我在 file.exists() 之前运行它
        File mediadir = getDir("tvr", Context.MODE_PRIVATE);
        if (mediadir.isDirectory()) {
            String[] children = mediadir.list();
            for (int i = 0; i < children.length; i++) {
                new File(mediadir, children[i]).delete();
            }
        }