getExternalStorageDirectory does not save the files to SdCard
<p>the camera app that i'm writing has the permissions <code>WRITE_EXTERNAL_STORAGE</code> and <code>READ_EXTERNAL_STORAGE</code> both.</p>

<p>i use the <code>getExternalStorageDirectory()</code> method to write files to main directory of SD Card. I'm not running it on emulator. My device is <code>Xperia Z3C</code> and has <code>Android 6.0.1</code>.</p>

<p>when i have the path that <code>getExternalStorageDirectory()</code>'s given is <code>"/storage/emulated/0/".</code></p>

<p>Then the files are saved on internal storage main directory.</p>

<pre><code> private static File getOutputMediaFile(int type){



        File mediaStorageDir = new File(Environment.getExternalStorageDirectory(), "Flash");
        Log.d("adasd", mediaStorageDir.getAbsolutePath());



        if (! mediaStorageDir.exists()){
            if (! mediaStorageDir.mkdirs()){
                Log.d("MyCameraApp", "failed to create directory");
                return null;
            }
        }


        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        File mediaFile;
        if (type == MEDIA_TYPE_IMAGE){
            mediaFile = new File(mediaStorageDir.getPath() + File.separator +
                    "IMG_"+ timeStamp + ".jpg");
        } else if(type == MEDIA_TYPE_VIDEO) {
            mediaFile = new File(mediaStorageDir.getPath() + File.separator +
                    "VID_"+ timeStamp + ".mp4");
        } else {
            return null;
        }

        return mediaFile;
    }
</code></pre>