try {
FileOutputStream out = new FileOutputStream("p1");
pictureTaken.compress(Bitmap.CompressFormat.PNG, 90, out);
out.close();
} catch (Exception e) {
e.printStackTrace();
}
和嘗試的FileInputStream和FileOutputSteam都拋出異常
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;
兩個嘗試,但他們沒有在去錯誤傳遞,他們只是到了抓...我得到大多數零件在線並根據我的需要修改它們,但即便如此,這一切都是有道理的,並在我的腦海中起作用。只是不明白爲什麼會拋出異常。
什麼是拋出的異常? – verdesmarald 2011-05-22 05:37:30