2010-07-22 49 views
1

这里是我做的android为什么我无法检索压缩的位图?

FileOutputStream out = new FileOutputStream(
         "/sdcard/Deltio1.jpg"); 
       Bitmap e = BitmapFactory.decodeByteArray(imageData, 0, 
         imageData.length); 
       e.compress(Bitmap.CompressFormat.JPEG, 65, out); 
       out.close(); 

和它抛出java.io.StreamCorruptedException

回答

1

发现它捡回来

FileInputStream fin = new FileInputStream("/sdcard/Deltio1.jpg"); 
      ObjectInputStream in = new ObjectInputStream(fin); 
      Bitmap bitmap; 
       bitmap = (Bitmap) in.readObject(); 
       ImageView photo = (ImageView) findViewById(R.id.katagelia_photo); 
       photo.setImageBitmap(bitmap); 

。但是我把它放开讨论,为什么第一个失败。

Bitmap bm = BitmapFactory.decodeFile(myJpgPath, options); 
options.inSampleSize = 2;