Hello,
I have an app where I let users take pictures and at the same time I
stream pictures to the user based on their location. Im storing the
image files from the download in a file that is supposed to be on the
sd card but for some reason gets created on the internal memory. Just
recently I hit a problem where suddenly after about 80 small image
files have been downloaded into the file my app will no longer allow
users to take images. I get no crash but just a warning in the logcat
that states
Java.IO.Exception no space left on device
This is happening when I am trying to create a file from an
outputstream.
In my code this error happens at this particular line:
bmp.compress(Bitmap.CompressFormat.PNG, 80, out);
I have that line nested within a method that I use to create an image
that can be stored locally on the phone rather than in memory so I
dont run out of memory.
The whole method looks like this:
private void writeFile(Bitmap bmp, File f) {
FileOutputStream out = null;
try {
out = new FileOutputStream(f);
bmp.compress(Bitmap.CompressFormat.PNG, 80, out);
} catch (NullPointerException e) {
e.printStackTrace();
Log.w("nullpointerException on image error",
"nullpointer");
} catch (FileNotFoundException e) {
Log.w("fileNotfoundException on image error",
"filenotfound");
// TODO Auto-generated catch block
e.printStackTrace();
}
finally {
try { if (out != null ) out.close(); }
catch(Exception ex) {}
}
}
both catches never hit when this method fails so I guess Im hitting
the final catch in the finally block.
I have done some research on this and I do not think Im running into
the problem of having to many files in one directory or using names
that are too long. The file names are 1 to 5 characters at most and
last week I was able to have over 400 files in the same directory
without any problems like this occurring. The phone Im testing on at
the moment has over 1gig free of internal and close to the same on the
external so hard memory is not the issue either. This is a sudden
problem that just came on last week so Im kind of stumped and any help
would be much appreciated.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en