I am trying to pass the bytes array from camera picture callback
using intents for further action. I have created the camera and it works fine using SurfaceView
.
Here's my method to pass the raw image bytes:
private Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] bytes, Camera camera) {
Intent intent = new Intent(MainActivity.this, PreviewActivity.class);
intent.putExtra("image", bytes);
startActivity(intent);
}
};
This code launches the next activity but a black screen shows up and in logs I can see this exception:
android.os.TransactionTooLargeException: data parcel size 1712172 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:622)
at android.app.ApplicationThreadProxy.scheduleLaunchActivity(ApplicationThreadNative.java:915)
at com.android.server.am.ActivityStackSupervisor.realStartActivityLocked(ActivityStackSupervisor.java:1421)
at com.android.server.am.ActivityStackSupervisor.attachApplicationLocked(ActivityStackSupervisor.java:901)
at com.android.server.am.ActivityManagerService.attachApplicationLocked(ActivityManagerService.java:7529)
at com.android.server.am.ActivityManagerService.attachApplication(ActivityManagerService.java:7600)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:541)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3065)
at android.os.Binder.execTransact(Binder.java:570)
I have skipped the surfaceview codes, fro brevity. What options do I have to pass this to next activity? Thanks.