how to delete written data from external storage?
<p>I'm using following function to write a object to external storage.</p>

<p>After using it i want to delete that object from external storage to free memory. 
Can any one guide me what should i do?</p>

<pre><code>public boolean saveObject(List&lt;DalCategories&gt; obj) {
   if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
      cacheDir=new File(android.os.Environment.getExternalStorageDirectory(),"MyCustomObjectForSearchFilter");
   } else {
      cacheDir= getCacheDir();
      if(!cacheDir.exists()) {
         cacheDir.mkdirs();
      }
      final File suspend_f = new File(cacheDir, "test");
      FileOutputStream fos = null;
      ObjectOutputStream oos = null;
      boolean keep = true;
      try {
         fos = new FileOutputStream(suspend_f);
         oos = new ObjectOutputStream(fos);
         oos.writeObject(obj);
      } catch (Exception e) {
         keep = false;  
      } finally {
         try {
            if (oos != null) {   
               oos.close();
            }
            if (fos != null) {  
               fos.close();
            } 
            if (keep == false) {
               suspend_f.delete();
            }
         } catch (Exception e) { 
            keep = false;
         }
      }
      return keep; 
   }
</code></pre>
