Android: how to save image to cache dir?
<p>I have saw a lot of similar question trought stackoverflow but no one helps me. I have the code as this:</p>

<pre><code>String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state)) {
        //create name based on time? just a simple link to photo
        //save to cache file
        File file = getExternalCacheDir();
        if (file != null) {
            try {
                String root = file.getAbsolutePath();
                File imageFile = new File(file, "m_images.jpeg");
                boolean tr = imageFile.mkdirs();
                FileOutputStream stream = new FileOutputStream(imageFile);
                boolean complete = image.compress(Bitmap.CompressFormat.PNG, 90, stream);
                if (!complete) {
                    Log.d("tag", "image doesn't saved");
                }
                Log.d("tag", "image saved");
            } catch (IOException e) {
                Log.d("tag", "Can't save image", e);
            }
</code></pre>

<p>But I always get this exception when I open FileOoutputStream:</p>

<pre><code>java.io.FileNotFoundException: /mnt/sdcard/Android/data/com.whatever/cache/m_images.jpeg (Is a directory)
</code></pre>

<p>Could you say where is the cause of this issue? Why file doesn't create? </p>
