FileNotFoundExcecption while inserting image into SDCard
<p>I want to insert images into my SDCard.So I used below code</p>

<p>m_cImagePath = "/sdcard/"+ String.format("%d.jpg", System.currentTimeMillis());</p>

<pre><code>        FileOutputStream lObjOutStream = null;
        try {
            lObjOutStream = new FileOutputStream(m_cImagePath);
            if (null != lObjOutStream &amp;&amp; null != finalBitmap) {
                finalBitmap.compress(Bitmap.CompressFormat.JPEG, 85, lObjOutStream);
                lObjOutStream.close();
            }catch(FileNotFoundException fe){
fe.printStackTrace();
}
</code></pre>

<p>Sometimes it is giving FileNotFoundException even my SDCard had memory.When I remove some images from sdcard again it is working smoothly.Why this Happend?How can i know that file is inserted successfully in SDCard and Is there any functionality in Java1.5 to know available space of the SDCard like java 1.6?How can i know file length which is not before inserting into the SDCard(I searched in google and found that </p>

<blockquote>
  <p>"when the file is not physically there
  then file.length() always gives 0"</p>
</blockquote>

<p>).But before inserting i want to know the length of the file.Then Comparing this space to available SDCard space is simple.</p>

<p>Note :I had an idea to use Unix command </p>

<blockquote>
  <p>df sdcard</p>
</blockquote>

<p>using in </p>

<blockquote>
  <p>Runtime class</p>
</blockquote>

<p>to found SDCard space.</p>

<p>Please give me an idea in this problem.</p>

<p>Regards,
Android Developer</p>
