且构网

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

Android的;检查文件是否存在,而无需创建一个新的

更新时间:2023-12-03 21:09:34

您的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.