title: Android saving file to cache directory
body: <p>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.</p>
  
  <p>Here is my code:</p>
  
  <pre><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();
      }
  }
  </code></pre>
  
  <p>And I keep getting the following error:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>Thank you for the help.</p>