0

I need a viable workaround for this problem. I take a picture using the android Camera. The method invoked is called onPictureTaken. The program is supposed to take the byte array from the picture, and pass it back to the intent waiting for it in another class.

My problem is that I get the Failed Binder Transaction error. I know this is because the data is too big. Is there a viable way to compress it before sending it?

**Note, I know I could just make and compress a bitmap, but its far more preferable with the way my program is written to send the actual byte array instead.

Code below:

public void onPictureTaken(byte[] data, Camera camera) {
            Toast.makeText(getApplicationContext(), "Picture Taken",
                    Toast.LENGTH_SHORT).show();

            //start of finish intent
            Intent intent = new Intent();
            intent.putExtra("image_arr", data);
            setResult(1, intent);
            camera.stopPreview();
            if (camera != null) {
                camera.release();
                mCamera = null;
            }

            finish();

In addition, I only get this error on some android devices, for example my GS5 does not throw this error, but my Moto X does. Is there a way to make sure the compression that will be done is enough that it won't throw an error on the device?

Thanks!

Onik
  • 19,396
  • 14
  • 68
  • 91
balloway
  • 161
  • 4
  • 13

0 Answers0