-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 );
        }
4

1 回答 1

0

@朱利安是对的。实际上你可以尝试使用类的exists()函数File

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

有许多类似的问题可能会有所帮助:

希望能帮助到你。

于 2013-09-01T21:03:19.537 回答