无法解析符号“存在”android 4.0

时间:2013-12-24 04:02:52

标签: android file java-io

我有一个问题。请参考下面的照片:

error

他为什么会这样? 我需要检查文件是否存在。 我已经导入了Java.IO类。

3 个答案:

答案 0 :(得分:1)

检查:

File file = new File("");

if (file.exists())
{
   // Do Something..
}

希望这有帮助。

答案 1 :(得分:0)

File file = new File(Your_file_Path);
        if(file.exists())      
        //Do somehting
        else
        // Do something else.

答案 2 :(得分:0)

您需要在函数范围内而不是在类本身内调用存在