String fileName = String.valueOf(System.currentTimeMillis())+".jpg";
String path = Environment.getExternalStorageDirectory().toString() + "/puzzlemaker/";
FileOutputStream outStream = null;
try{
File file = new File(path);
file.mkdirs();
outStream = new FileOutputStream(path + fileName);
outStream.write(data);
}catch(FileNotFoundException e){
e.printStackTrace();
}catch(IOException e1){
e1.printStackTrace();
}finally{
try{
outStream.close();
}catch(Exception e2){
e2.printStackTrace();
}
}
The above code I have written to write an image in my described directory inside the sdcard. But everytime the image is stored inside the sdcard itself but not inside my described directory.
NOTE: I have already searched a lot of answers in the stackoverflow, but every answer is similar to this code. So I am unable to find the problem.
I have already uses the permission for writting in the external storage device in the manifest file.
Please help me, where I have the problem.