try {
FileOutputStream out = new FileOutputStream("p1");
pictureTaken.compress(Bitmap.CompressFormat.PNG, 90, out);
out.close();
} catch (Exception e) {
e.printStackTrace();
}
and
case R.id.open:
ImageView im = (ImageView) findViewById(R.id.im);
try {
FileInputStream in = new FileInputStream("p1");
BufferedInputStream buf = new BufferedInputStream(in);
byte[] bitMapA= new byte[buf.available()];
buf.read(bitMapA);
Bitmap bM = BitmapFactory.decodeByteArray(bitMapA, 0, bitMapA.length);
im.setImageBitmap(bM);
if (in != null) {
in.close();
}
if (buf != null) {
buf.close();
}
} catch (Exception e) {
e.printStackTrace();
}
break;
Both try, but they don't pass in de-bug, they just got to the catch... I got most of these parts online and modified them to my needs, but even so, it all makes sense and works in my head. Just don't see why it throws the exception.