android - Android中的android.os.TransactionTooLargeException错误
问题描述
我的 Android 应用程序返回android.os.TransactionTooLargeException时遇到问题,即使我清除了 Fragment 中的所有数据。
从我实现的片段 - 请参阅下面的代码,我开始一个新活动,该活动开始但一秒钟后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");
}
}
解决方案
请试试 :-
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");
}
}
推荐阅读
- android - 尝试过于频繁地从其值中过滤数据时,MutableLiveData 值会被清除
- javascript - 如何在 MarkLogic Javascript 中复制和修改文档?
- jquery - 如何使用选择取消全选解决Jquery问题
- oracle - Oracle.ManagedDataAccess.Client 无法使用 Windows 身份验证进行连接
- python - 为什么用 numpy 广播的速度不比嵌套循环快
- python - 在较大的 PyCharm 或 IntelliJ 项目中,是否支持具有自己的 virtualenvs 的子目录?
- python - 一种热编码的正确方法
- jquery - jQuery:替换如果此 HREF 包含
- javascript - 传递一个解构的对象?
- php - 如何为每个表列制作过滤器?