lundi 18 mai 2015

Android: How to return huge byte array as activity's result?

private void returnImage(byte[] array)
{
    Intent intent = new Intent();
    intent.putExtra(RETURNING_MESSAGE, array);
    setResult(RESULT_OK, intent);
    finish();
}

I get that byte array by Camera via these callbacks

@Override
public void onClick(View v) {
    mCamera.takePicture(null, null, new Camera.PictureCallback() {
        @Override
        public void onPictureTaken(byte[] data, Camera camera) {
            mCamera.release();
            returnImage(data);
        }
    });
}

At runtime I use the camera but the activity doesn't finish and Logcat says that E/JavaBinder﹕ !!! FAILED BINDER TRANSACTION !!! Is it caused by the size of the image? I checked and found out that it's over 2 million bytes. I need to use my custom camera but I can't return my data.

Aucun commentaire:

Enregistrer un commentaire