title: Folder created on android sd card, but file not created
body: <p>I think I have looked at all of the relevant questions and I still can't get this to work.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>File sdCard = Environment.getExternalStorageDirectory();  
  File directory= new File (sdCard.getAbsolutePath() + appName);          
  directory.mkdirs();     
  File file = new File(directory,fileName);  
  </code></pre>
  
  <p>The folder is created, but I get an error saying the file does not exist. appName is a string containing the name of the folder and that works correctly. fileName is a string containing the name of the file I want to include.</p>
  
  <p>I have included the permission in the manifest.</p>
  
  <p>What am I doing wrong? </p>
  
  <p>Update:</p>
  
  <p>The code tries to make a subdirectory and a file at the same time, which hidden because the code uses a named String rather than a String literal. Adding an intermediate step to create the subdirectory solved the problem.</p>