我在遇到崩溃的报告时经常不知道为什么这个例外?
Fatal Exception: java.lang.RuntimeException: Failure from system at android.app.Instrumentation.execStartActivity(Instrumentation.java:1547) at android.app.Activity.startActivityForResult(Activity.java:4283) at android.app.Activity.startActivityForResult(Activity.java:4230) at android.support.v4.app.FragmentActivity.startActivityForResult(Unknown Source) at android.app.Activity.startActivity(Activity.java:4567) at android.app.Activity.startActivity(Activity.java:4535) at com.app.Register.MainActivity.onClick(Unknown Source) at android.view.View.performClick(View.java:5702) at android.widget.TextView.performClick(TextView.java:10887) at android.view.View$PerformClick.run(View.java:22533) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by android.os.TransactionTooLargeException: data parcel size 8177736 bytes at android.os.BinderProxy.transactNative(Binder.java) at android.os.BinderProxy.transact(Binder.java:503) at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:3130) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1540) at android.app.Activity.startActivityForResult(Activity.java:4283) at android.app.Activity.startActivityForResult(Activity.java:4230) at android.support.v4.app.FragmentActivity.startActivityForResult(Unknown Source) at android.app.Activity.startActivity(Activity.java:4567) at android.app.Activity.startActivity(Activity.java:4535) at ca.dailydelivery.driver.Register.AdditionalInfoActivity.onClick(Unknown Source) at android.view.View.performClick(View.java:5702) at android.widget.TextView.performClick(TextView.java:10887) at android.view.View$PerformClick.run(View.java:22533) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7224) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
我在这个生成崩溃的活动中正在做的是通过Intent从Camera或Gallery捕获图像.
代码:
private void captureImage() { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // start the image capture Intent startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE); } private void openGallery() { Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, IMAGE_PICK_GALLERY); }
请建议如何解决此问题.谢谢
减少从相机拍摄的图像大小,然后发送到其他活动.因为当我们传递值时,它对事务有一些限制.
Binder事务缓冲区具有有限的固定大小,当前为1Mb,由进程正在进行的所有事务共享.因此,即使大多数单个事务的大小适中,当有许多事务正在进行时,也会抛出此异常.
更多细节TransactionTooLargeException