How to solve error :“ !!! FAILED BINDER TRANSACTION !!! ” in android 4.4

后端 未结 3 805
鱼传尺愫
鱼传尺愫 2020-12-16 10:36

I used custom camera application then i open this app working fine but i open the camera view and take the picture get error Failed binder transaction in android 4.4 version

相关标签:
3条回答
  • 2020-12-16 11:01

    in the code ,

    PictureCallback mPicture = new PictureCallback() {
        @Override
        public void onPictureTaken(byte[] data, Camera camera) {
    
            if (ImageType.equals("AddPicture")) {
                Intent i = new Intent(CameraActivity.this,MarketPlaceActivity.class);
                i.putExtra("data", data);// problem lies here
                startActivity(i);
            } else {
                Intent returnIntent = new Intent();
                returnIntent.putExtra("data", data);// problem lies here
                setResult(RESULT_OK, returnIntent);
                CameraActivity.this.finish();
            }
        }
    };
    

    you are trying to parse large data along with intent but as per the documentation, the Binder transaction failed because it was too large.

    Solution :

    I would suggest you to create bitmap from the received byte[] data and store the image on device.then just parse the path of that image to any other activity according to your requirement.

    0 讨论(0)
  • 2020-12-16 11:22

    I think the problem is from this: returnIntent.putExtra("data", data);. The transaction data is limited in intent. If you need a bitmap or a big file, you must not pass it as an extra instead just pass image path or uri and make the bitmap or file in your activity where you are displaying or using it.

    0 讨论(0)
  • 2020-12-16 11:24

    see this thread. Quotation: It fails because you are trying to send an image as an intent extra and it is too large for it. You can't send image using IPC communication technics like intents or service/binder, there is a limit of 1mb/10mb depending on version of android.

    0 讨论(0)
提交回复
热议问题