How to convert ByteBuffer into image in Android
问题 I am receiving jpg image through socket and it is sent as ByteBuffer what I am doing is: ByteBuffer receivedData ; // Image bytes byte[] imageBytes = new byte[0]; // fill in received data buffer with data receivedData= DecodeData.mReceivingBuffer; // Convert ByteByffer into bytes imageBytes = receivedData.array(); ////////////// // Show image ////////////// final Bitmap bitmap = BitmapFactory.decodeByteArray(imageBytes,0,imageBytes.length); showImage(bitmap1); But what is happening that it