android - file.exists() returns false for existing file (for anything different than pdf)

前端 未结 4 780
感动是毒
感动是毒 2020-12-31 05:19

Both files are present on the sdcard, but for whatever reason exists() returns false the the png file.

//String path = \"/mnt/sdcard/Android/data/com.gemoro.         


        
4条回答
  •  孤城傲影
    2020-12-31 05:36

    Please try this code. Hope it should helpful for you. I am using this code only. Its working fine for me to find the file is exists or not. Please try and let me know.

    File file = new File(path);
        if (!file.isFile()) {
             Log.e("uploadFile", "Source File not exist :" + filePath);
        }else{
        Log.e("uploadFile","file exist");
    }
    

提交回复
热议问题