title: How to delete a file in Java (Android)
body: <p>I'm trying to run the following code when an android activity is created, so that two files will be deleted.</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      File file = new File (CSQ1.likes_filename);
      file.delete();
      file = new File (CSQ1.answers_filename);
      file.delete();
  
      // Rest of onCreate function
  }
  </code></pre>
  
  <p>Seems simple enough, but it doesn't work. What am I doing wrong?</p>