Android的;检查文件是否存在,而无需创建一个新的 [英] Android; Check if file exists without creating a new one
本文介绍了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.
这篇关于Android的;检查文件是否存在,而无需创建一个新的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文