Still get error FAILED BINDER TRANSACTION although have compressed it

前端 未结 2 1565
自闭症患者
自闭症患者 2021-01-27 19:45

I wanted to return the image from AddMoreClaims to AddClaims listView. When I click the submit button in AddM

2条回答
  •  心在旅途
    2021-01-27 20:25

    I think you are not compressing the bmp where you should do it.

        submit.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
    
            Intent returnIntent = new Intent();
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
            byte[] bytes = stream.toByteArray();
            returnIntent.putExtra("BMP", bytes);
            setResult(Activity.RESULT_OK, returnIntent);
            finish();
    
        }
    });
    

    Then you should to uncompress where you need to show the image

    byte[] bytes = data.getByteArrayExtra("BMP");
    Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
    imageView.setImageBitmap(bmp);
    

提交回复
热议问题