-1

I'm tried to implement following if condition to skip the downloading process if the file found. But the if condition doesn't seem to be working and without if condition this works fine. can someone please help to solve this. I think, I used the if condition improperly.

File file = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/com.sample.project/files/images/");
        if(file.getPath().equals(false)){
            String url = "http://www.sample.com/example.zip";
            new DownloadTask().execute( url );
        }
Kabe
  • 223
  • 2
  • 4
  • 16

1 Answers1

0

@Julien is right. Actually you may try using exists() function of File class.

if (file.exists()){
    //true
}else{
    //false
}

There are many similar questions which may help:

Hope it helps.

Community
  • 1
  • 1
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124