title: java.io.IOException: open failed: EBUSY (Device or resource busy) in android
body: <p>I am creating a file in SD Card and storing image file in it, by using default camera.
  That works fine.</p>
  
  <p>But from 2 days i am getting an Exception of</p>
  
  <pre><code>`12-25 11:50:59.328: W/System.err(5063): java.io.IOException: open failed: EBUSY (Device or resource busy)
  12-25 11:50:59.328: W/System.err(5063):     at java.io.File.createNewFile(File.java:946)
  12-25 11:50:59.328: W/System.err(5063):     at java.io.File.createTempFile(File.java:1011)
  12-25 11:50:59.328: W/System.err(5063):     at tv.caseguard.swipe.fragment.CameraPhoto.setImageUri(CameraPhoto.java:414)
  12-25 11:50:59.328: W/System.err(5063):     at tv.caseguard.swipe.fragment.CameraPhoto.dispatchTakePhotoIntent(CameraPhoto.java:380)
  12-25 11:50:59.328: W/System.err(5063):     at tv.caseguard.swipe.fragment.CameraPhoto.onClick(CameraPhoto.java:295)
  12-25 11:50:59.328: W/System.err(5063):     at android.view.View.performClick(View.java:4438)
  12-25 11:50:59.328: W/System.err(5063):     at android.view.View$PerformClick.run(View.java:18422)
  12-25 11:50:59.328: W/System.err(5063):     at android.os.Handler.handleCallback(Handler.java:733)
  12-25 11:50:59.328: W/System.err(5063):     at android.os.Handler.dispatchMessage(Handler.java:95)
  12-25 11:50:59.328: W/System.err(5063):     at android.os.Looper.loop(Looper.java:136)
  12-25 11:50:59.328: W/System.err(5063):     at android.app.ActivityThread.main(ActivityThread.java:5017)
  12-25 11:50:59.328: W/System.err(5063):     at java.lang.reflect.Method.invokeNative(Native Method)
  12-25 11:50:59.328: W/System.err(5063):     at java.lang.reflect.Method.invoke(Method.java:515)
  12-25 11:50:59.328: W/System.err(5063):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  12-25 11:50:59.328: W/System.err(5063):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  12-25 11:50:59.328: W/System.err(5063):     at dalvik.system.NativeStart.main(Native Method)
  12-25 11:50:59.328: W/System.err(5063): Caused by: libcore.io.ErrnoException: open failed: EBUSY (Device or resource busy)
  12-25 11:50:59.328: W/System.err(5063):     at libcore.io.Posix.open(Native Method)
  12-25 11:50:59.328: W/System.err(5063):     at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
  12-25 11:50:59.338: W/System.err(5063):     at java.io.File.createNewFile(File.java:939)
  12-25 11:50:59.338: W/System.err(5063):     ... 15 more
  `
  </code></pre>
  
  <p>My code part</p>
  
  <pre><code>try {
          _imageFileName = "Image_"+_timeStamp;
          _image = File.createTempFile(_imageFileName,".png", fileImage);
          imgUri = Uri.fromFile(_image);
          _imagePath = _image.getAbsolutePath(); // _video is file to send and _videoPath is string path
          System.out.println("Image path on sd card=" + _imagePath);
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  </code></pre>
  
  <p>How can I fix this?</p>