且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android的;检查文件是否存在,而不创建新文件

更新时间:2023-09-28 08:27:52

你的代码块不会创建一个新的代码,它只检查它是否已经存在,没有其他的。

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 something
else
// Do something else.