[Android] Display Bitmap

當我的bitmap send to another android, it will crash
請CHING指教..

Sender:
  1. ByteArrayOutputStream stream = new ByteArrayOutputStream();
  2. bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
  3. byte[] byteArray = stream.toByteArray();
複製代碼
Receiver:
  1. socket = ssocket.accept();
  2. Log.e(logtag, "Get Data Now");
  3. byteArray = readBytes();
  4. ByteArrayInputStream arrayInputStream = new ByteArrayInputStream(byteArray);
  5. Bitmap bitmap = BitmapFactory.decodeStream(arrayInputStream);   //imageView.setImageBitmap(bitmap); <<< Throw Exception!
複製代碼

Decode encode pair 係咪一對?

via HKEPC Reader for Android

TOP

有冇響收果邊check下byteArray size同sender果邊一唔一樣?

TOP