小字符串的TransactionTooLargeException错误

时间:2018-07-31 15:51:32

标签: java android

我从某些用户那里收到TransactionTooLargeException错误。但是我没有发送大文本,位图等。我只是发送字符串。这是我的代码:

FrameLayout layout = (FrameLayout) findViewById(R.id.container);
            layout.setVisibility(View.VISIBLE);
            FragmentManager fragmentManager = getSupportFragmentManager();
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

            Bundle sendData = new Bundle();
            sendData.putString("sendTo",sendTo);
            sendData.putString("senderName",senderName);
            sendData.putString("anonClosed",anonClosed);
            sendData.putBoolean("isConnectedToXmpp",isConnectedToXmpp);
            sendData.putBoolean("isOauthed",isOauthed);
            sendData.putString("loggedUsername",LOGGED_USERNAME);
            sendData.putString("loginKey",LOGIN_KEY);

            frgObj = new ConversationFragment();
            frgObj.setArguments(sendData);

错误:

java.lang.RuntimeException: 
  at android.app.ActivityThread$StopInfo.run (ActivityThread.java:4009)
  at android.os.Handler.handleCallback (Handler.java:789)
  at android.os.Handler.dispatchMessage (Handler.java:98)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6565)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
Caused by: android.os.TransactionTooLargeException: 
  at android.os.BinderProxy.transactNative (Native Method)
  at android.os.BinderProxy.transact (Binder.java:748)
  at android.app.IActivityManager$Stub$Proxy.activityStopped (IActivityManager.java:4636)
  at android.app.ActivityThread$StopInfo.run (ActivityThread.java:4001)

调试:

enter image description here

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

将此代码添加到您的ConversationFragment

 @Override
 public void onSaveInstanceState(Bundle oldInstanceState) {
        super.onSaveInstanceState(oldInstanceState);
        oldInstanceState.clear();
    }