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.
Probably you created directory before with wrong call. Try to clean app data in settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With