I am trying to do something simple like save a file to a cache directory in Android and I am having a lot of problems. I am using Simple serializer to write out my file into xml.
Here is my code:
public void testWrite(ListDefinitions ld)
{
Serializer serializer = new Persister();
String fileName = "sampleExport.xml";
try {
File file = new File(mContext.getCacheDir(), fileName);
file.createNewFile();
serializer.write(ld, file);
} catch (Exception e) {
e.printStackTrace();
}
}
And I keep getting the following error:
09-18 00:35:06.229: W/System.err(4442): java.io.FileNotFoundException: /data/data/com.main/cache/sampleExport.xml: open failed: EISDIR (Is a directory)
Thank you for the help.