开发者

Android: File.exists returns true when it should return false

开发者 https://www.devze.com 2023-03-26 19:12 出处:网络
I have a bizarre problem. I write a file to the SD card and then I remove the SD card. With the card removed, I then check for the existence of the file with File.exists.

I have a bizarre problem. I write a file to the SD card and then I remove the SD card. With the card removed, I then check for the existence of the file with File.exists.

The path to the file clearly indicates /mnt/sdcard/MyAppFolder/.....

So with:

File f = new File(filename);

Boolean exists = f.exists();

it returns true. How is this possible. The SD card is not even inserted. I stopped and re-ran the app but it always returns true. Wow Android is super!! It even keeps a connection to your SD card no matter where it is. Seriously folks, wh开发者_如何学运维at am I doing wrong?

0

精彩评论

暂无评论...
验证码 换一张
取 消