In my Android project i'm saving an image file into the device. in there I use the following code for creating file.
File folder = new File(getFilesDir());
if (!folder.exists()) {
folder.mkdir();
}
File imageFile = new File(folder, filename);
try
{
FileOutputStream fos = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.close();
}
catch (Exception e)
{
e.printStackTrace();
}
but this gives me File not found exception when creating FileOutputStream
FileOutputStream fos = new FileOutputStream(imageFile);
so the file seems not creating. how can I fix this.