Android中的android.os.TransactionTooLargeException错误

时间:2019-01-09 09:51:20

标签: android kotlin runtimeexception

即使我清除了Fragment中的所有数据,我的Android应用仍返回 android.os.TransactionTooLargeException 时遇到问题。

从我实现的片段开始-参见下面的代码,我启动了一个新活动,该活动开始了,但是一秒钟之后,抛出了 android.os.TransactionTooLargeException 。我尝试清理所有捆绑包等,因此该片段尽可能简单,但是会抛出:

  

java.lang.RuntimeException:android.os.TransactionTooLargeException:数据包大小608932字节。

您有任何想法吗,请问问题出在哪里?

public class ShowDetailFragment extends Fragment {

  public static boolean was207Called = false;

  public interface ExpandViewListener {
    void onExpandClicked();
  }

  public void setFullScreenListener(ExpandViewListener listener) {
  }

  public ShowDetailFragment() {
  }

  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_show_detail, null, true);
    return v;
  }

  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
  }

  @Override
  public void onResume() {
    super.onResume();
  }

  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, null);
    Intent i = new Intent(getActivity().getApplicationContext(), ForgottenPasswordActivity.class);
    startActivity(i);
    return;
  }

  @Override
  public void onPause() {
    super.onPause();
  }

  @Override
  public void onSaveInstanceState(Bundle outState) {
  }

  public void onFragmentRemoved() {
    Log.d("XXXXX", "Frag removed");
  }

  @Override
  public void onStop() {
    super.onStop();
    Log.d("XXXX", "Stopping");
  }
}

1 个答案:

答案 0 :(得分:0)

请尝试:-

public class ShowDetailFragment extends Fragment {

  public static boolean was207Called = false;

  public interface ExpandViewListener {
    void onExpandClicked();
  }

  public void setFullScreenListener(ExpandViewListener listener) {
  }

  public ShowDetailFragment() {
  }

  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_show_detail, container, false);
    return v;
  }

  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
  }

  @Override
  public void onResume() {
    super.onResume();

    Intent i = new Intent(getActivity(), 
    ForgottenPasswordActivity.class);
    startActivity(i);
  }

  public void onFragmentRemoved() {
    Log.d("XXXXX", "Frag removed");
  }

  @Override
  public void onStop() {
    super.onStop();
    Log.d("XXXX", "Stopping");
  }
}