java.lang.RuntimeException:android.os.TransactionTooLargeException:在片段之间导航时数据包大小为 558780 字节
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 558780 bytes when navigating between fragment
我正在使用 Bundle
在活动和片段之间传输数据。当我从一个片段导航到新片段时,没有传输数据或使用 Bundle
获取数据,应用程序崩溃并出现以下错误。
> > 10-09 11:36:09.100 467-467/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 558780) 10-09 11:36:09.101 467-467/?
> D/AndroidRuntime: Shutting down VM 10-09 11:36:09.101 467-467/?
> E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxxx.xxxxmobileapp.debug, PID: 467
java.lang.RuntimeException: android.os.TransactionTooLargeException:
data parcel size 558780 bytes
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4156)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: android.os.TransactionTooLargeException: data parcel size 558780 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:628)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:4149)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4148)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
我们可以使用网桥或任何第三方工具来解决这个问题吗?如何解决这个问题?
您必须像这样传递带有 Bundle
的长字符串,并且您必须清除接收数据的 Bundle
。你可以用任何你认为好的方式。
1.Method:
Bundle bundle = new Bundle();
bundle.putString("This is just for testing purpose", "Developer program");
清除 Fragment
上的捆绑包对象
@Override
public void onViewCreated(View view, Bundle savedInstanceState)
{
String recStr= bundle.get("This is just for testing purpose");
bundle.clear();
}
2.Method
@Override
protected void onSaveInstanceState(Bundle oldInstanceState)
{
super.onSaveInstanceState(oldInstanceState);
oldInstanceState.clear();
}
它会帮助你。
我正在使用 Bundle
在活动和片段之间传输数据。当我从一个片段导航到新片段时,没有传输数据或使用 Bundle
获取数据,应用程序崩溃并出现以下错误。
> > 10-09 11:36:09.100 467-467/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 558780) 10-09 11:36:09.101 467-467/?
> D/AndroidRuntime: Shutting down VM 10-09 11:36:09.101 467-467/?
> E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxxx.xxxxmobileapp.debug, PID: 467 java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 558780 bytes at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4156) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6682) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) Caused by: android.os.TransactionTooLargeException: data parcel size 558780 bytes at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(Binder.java:628) at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:4149) at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4148) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6682) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
我们可以使用网桥或任何第三方工具来解决这个问题吗?如何解决这个问题?
您必须像这样传递带有 Bundle
的长字符串,并且您必须清除接收数据的 Bundle
。你可以用任何你认为好的方式。
1.Method:
Bundle bundle = new Bundle();
bundle.putString("This is just for testing purpose", "Developer program");
清除 Fragment
@Override
public void onViewCreated(View view, Bundle savedInstanceState)
{
String recStr= bundle.get("This is just for testing purpose");
bundle.clear();
}
2.Method
@Override
protected void onSaveInstanceState(Bundle oldInstanceState)
{
super.onSaveInstanceState(oldInstanceState);
oldInstanceState.clear();
}
它会帮助你。