Raul Petrescu
Raul Petrescu

Reputation: 69

Java project error

I get this error from Eclipse:

The constructor File(List<String>) is undefined

at this part of the code

 public void deleteFunction(int id){ 
         Toast.makeText(this, "Sters", Toast.LENGTH_SHORT).show();
        File file = new File(path); 
         boolean deleted = file.delete();
        }  

Upvotes: 1

Views: 72

Answers (2)

ρяσѕρєя K
ρяσѕρєя K

Reputation: 132982

because path is ArrayList and you will need to pass path of file from path ArrayList instead of whole ArrayList change your code as:

 public void deleteFunction(int id){ 
         //...
         if(id<path.size()){
          File file = new File(path.get(id)); 
          boolean deleted = file.delete();
         }
        }  

Upvotes: 1

Daniel Hedberg
Daniel Hedberg

Reputation: 5817

It simply means there's no File constructor taking a list of strings.

Upvotes: 1

Related Questions