Android的;检查文件是否存在,而无需创建一个新的
问题描述:
我要检查文件是否存在在我的包文件夹,但我不希望创建一个新的。
I want to check if file exists in my package folder, but I don't want to create a new one.
File file = new File(filePath);
if(file.exists())
return true;
请问而无需创建一个新的文件中,此code检? 和感谢。
Does this code check without creating a new file ? and Thanks.
解决了.....谢谢大家
答
您的code块不会创建一个新的,它只是检查是否其已经在那里了,没有别的。
Your chunk of code does not create a new one, it only checks if its already there and nothing else.
File file = new File(filePath);
if(file.exists())
//Do somehting
else
// Do something else.