caching - Android open file I wrote to cache -


I am trying to read a file that I had already created in the application's cache directory

Yes I used the file (Java.io.file) to create a file in the cache directory, I check to see if the file created is present in the file

but the second class I need to open that file (a class that does not exist unless the file exists Of the call), I want to use openFileInput (string filename), but does not allow openFileInput file path! This is also not the default in the cache directory, what a puzzle! (To see all different exceptions, using the debugger will throw open file input, it either does not file or invalid arguments when the name of the path is inputted)

Let me tell this file Need another way to get When I was reading and writing for storage, everything used to work, but I needed to use the cache.

I want to use openFileInput (string filename), but openFileInput file path Does not give!

Of course.

This is also the default cache directory

Not so.

I would like another way to get this file.

Use the Java file I / O, in the same way you created the file. As you did (hopefully) when you created the file, getCacheDir () gives the application's cache directory to use the same file constructor used to write in the file to read from the file.

Comments