我从Eclipse中收到此错误:
The constructor File(List<String>) is undefined
代码的这一部分
public void deleteFunction(int id){
Toast.makeText(this, "Sters", Toast.LENGTH_SHORT).show();
File file = new File(path);
boolean deleted = file.delete();
}
答案 0 :(得分:1)
它只是意味着没有File
构造函数获取字符串列表。
答案 1 :(得分:1)
因为路径是ArrayList
而你需要从路径ArrayList而不是整个ArrayList传递文件路径,所以将代码更改为:
public void deleteFunction(int id){
//...
if(id<path.size()){
File file = new File(path.get(id));
boolean deleted = file.delete();
}
}