[问题] outputStream 连续写入大量图片 crash

楼主: issuemylove (NotLove)   2014-06-26 15:37:32
各位大大好
我用 output stream 将 bitmap 输出成 jpg 图片档
在单张输出的情况下,完美成功了
但是当我大量输出好几张(10几张) jpg 图片档时
立马就crash了
我以为是我没有用成 thread的关系
但用thread来做这件事情的时候却是一样的结果
请问要怎样办到输出大量 bitmap 成图片档案的方法呢?
谢谢!
以下是我的程式码
Thread thread = new Thread( new Runnable(){
public void run(){
Bitmap[] photos = (很多bitmaps);
for( int i=0; i<photos.length;++i){
File photoFile = new File("sdcard/"+i+".jpg");
try{
FileOutputStream out = new FileOutputStream(photoFile);
photos[i].compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
out.close();
Thread.sleep(500);
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
thread.start();
楼主: issuemylove (NotLove)   2014-06-26 16:23:00
是瞬间app闪掉,没有错误讯息

Links booklink

Contact Us: admin [ a t ] ucptt.com