title: Android File not created on SD card
body: <p>I'm trying to create a file on the SD on my device. This worked a week ago, but now it isn't, and I don't understand why.</p>
  
  <p>The Logcat prints:</p>
  
  <pre><code>java.io.FileNotFoundException ...pathtofile... (no such file or directory)
  </code></pre>
  
  <p>So, the file is not being created. I have the correct permissions on the android manifest:</p>
  
  <pre><code>  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"&gt;&lt;/uses-permission&gt;
  </code></pre>
  
  <p>I create the file this way:</p>
  
  <pre><code>if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
             base = Environment.getExternalStorageDirectory().getAbsolutePath();
         }
     String fname = File.separator +"VID_"+ timeStamp + ".3gp";
         mediaFile = new File(base+fname);
  </code></pre>
  
  <p>Then I check if it exists:</p>
  
  <pre><code>   if(mediaFile.exists()){
             Log.v("mediaFile","ex");
         }else{
             Log.v("mediaFile","no ex");
  
         }
  </code></pre>
  
  <p>And the log says that IT DOESN'T EXIST. I also have tried with file.createNewFile() and it doesn't work.</p>
  
  <p>So, a week ago it was working, now it doesn't work, it could be a problem with the SD card ???? Could it be some type of BUG!!!????</p>
  
  <p>Thanks</p>
  
  <p>EDIT: More Code</p>
  
  <p>The function where the file is created is :</p>
  
  <pre><code>private static File getOutputMediaFile()
  </code></pre>
  
  <p>Called from:</p>
  
  <pre><code>private static Uri getOutputMediaFileUri(){
           return Uri.fromFile(getOutputMediaFile());
     }
  </code></pre>
  
  <p>And setted to mediarecorder output as:</p>
  
  <pre><code>vMediaRecorder.setOutputFile(getOutputMediaFileUri().toString());
  </code></pre>
  
  <p>So, when I do mediarecorder.prepare():</p>
  
  <pre><code>try {
              vMediaRecorder.prepare();
  
          } catch (IllegalStateException e) {
              Log.v("RELEASE VIDREC1",e.toString());
              releaseMediaRecorder();
              return false;
          } **catch (IOException e) {
              Log.v("RELEASE VIDREC2",e.toString());
              releaseMediaRecorder();
              return false;**
          }
  </code></pre>
  
  <p>The bold catch is the one that runs, and prints:</p>
  
  <pre><code>java.io.FileNotFoundException ...pathtofile... (no such file or directory)
  </code></pre>