且构网

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

安卓;检查文件是否存在而不创建新文件

更新时间: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.