I made a file using :
FileOutputStream fos = app.openFileOutput("FileOne.txt", Context.MODE_APPEND); Later in the same program, I try to open this file using:
PrintWriter writer = new PrintWriter(context.getFileStreamPath("FileOne.txt")); but doing it give this exception in the LogCat:
06-05 09:49:32.230: D/error155 java.lang.RuntimeException: File not found(7707): [ 06-05 09:49:32.240 7707: 7736 D/ java.io.FileNotFoundException: /FileOne.txt: open failed: EROFS (Read-only file) I have checked the internal storage, and the file does exist. How to open the file correctly?
FileAPI sucks. If you use Java 7, make yourself a favor and use the newFilesAPI.FileNotFoundExceptionis also thrown if the file exists but you don't have the necessary credentials for what you are trying to do!