Android之android.system.ErrnoException: open failed: ENOENT (No such file or directory)
生活随笔
收集整理的這篇文章主要介紹了
Android之android.system.ErrnoException: open failed: ENOENT (No such file or directory)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1 問題
在sdcard目錄下面創(chuàng)建了一個文件提示下面的錯誤
android.system.ErrnoException: open failed: ENOENT (No such file or directory)
2 分析
錯誤代碼是如下
String path = Environment.getExternalStorageDirectory().getAbsolutePath();try {File dir = new File(path + "/***/***/***/");if (!dir.exists()) {dir.mkdir();}File file = new File(path + "/***/***/***/", fileName);if (file.exists()) {return file;}if (file.createNewFile()) {return file;}} catch (Exception e) {return null;}return null;}但是部分地方能正確運行
String path = Environment.getExternalStorageDirectory().getAbsolutePath();try {總結
以上是生活随笔為你收集整理的Android之android.system.ErrnoException: open failed: ENOENT (No such file or directory)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux之ubunt把启动栏底部和左边
- 下一篇: open ssl里面的自定义get***