Android unzip not a directory issue
<p>I am trying to unzip a zip file which is stored in the raw folder. Code is as follows</p>

<pre><code>try
{
    File myDir = new File(getFilesDir().getAbsolutePath());
    File newFile = new File(myDir + "/imageFolder");

if(!newFile.exists())
                    {
                        newFile.mkdir();
                    }

    ZipInputStream zipIs = new ZipInputStream(con
            .getResources().openRawResource(R.raw.images));
    ZipEntry ze = null;

    while ((ze = zipIs.getNextEntry()) != null)
    {

        Log.v("Name", ze.getName());
        Log.v("Size", "" + ze.getSize());

        if(ze.getSize() &gt;0)
        {
            FileOutputStream fout = new FileOutputStream(newFile
                    + "/" + ze.getName());                      

            byte[] buffer = new byte[1024];
            int length = 0;

            while ((length = zipIs.read(buffer)) &gt; 0)
            {
                fout.write(buffer, 0, length);
            }
            zipIs.closeEntry();
            fout.close();
        }   
        }

    zipIs.close();

} catch (Exception e)
{
    e.printStackTrace();
}
</code></pre>

<p>But I keep getting this error</p>

<blockquote>
  <p>01-18 11:24:28.301: W/System.err(2285): java.io.FileNotFoundException:
  /data/data/com.example.ziptests/files/imageFolder/TestImages/background.png
  (Not a directory)</p>
</blockquote>

<p>I have absolutely no idea why it is causing this, it finds the files, but when it comes to writing them out, it brings up that error. Originally I found a problem that was caused by having the zip file zipped up on the mac, so I zipped up the file on my windows machine instead, that got rid of one problem (when you zip on a mac, it adds these extra folders and files such s store.ds which causes an error when trying to unzip), but this not a directory error keeps coming up. </p>

<p>Any ideas why this is happening? </p>
