當我的bitmap send to another android, it will crash
請CHING指教..
Sender:- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
- byte[] byteArray = stream.toByteArray();
複製代碼 Receiver:- socket = ssocket.accept();
- Log.e(logtag, "Get Data Now");
- byteArray = readBytes();
- ByteArrayInputStream arrayInputStream = new ByteArrayInputStream(byteArray);
- Bitmap bitmap = BitmapFactory.decodeStream(arrayInputStream); //imageView.setImageBitmap(bitmap); <<< Throw Exception!
複製代碼 |