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.
Is it caused by the size of the image?
Yes.
I checked and found out that it's over 2 million bytes.
That is about twice as big as you can return.
I need to use my custom camera but I can't return my data.
Either:
Do not make these be separate activities, but instead have them as separate fragments within one activity, so you do not have to worry about an Intent
as being the limiting factor, or
Use something else, such as a (temporary!) reference from a static data member to the byte[]
, that allows multiple activities within the same app to share data, or
If the activity calling startActivityForResult()
is in a separate app, use a ContentProvider
to stream the bytes back