Android Exception: UncaughtException detected: java.lang.RuntimeException: Parcelable encountered IOExcepti

Exception information:
uncaughtexception detected: java.lang.runtimeexception: separable accounted IOException writing serializable object

causes

When transferring data between activities, there is a problem in implementing serializable interface

Entity class



public class GoodsBean implements Serializable {

    private String createtime;
    private String images;
    private int clickCount;
    private UniUserBean uniUser;
    private String mobile;
    private String description;
    private int catId;
    private int createid;
    private double price;
    private String name;
    private int id;
    private int status;

Second Activity

    private void exit4Goods(int position) {
        if (mGoodLists != null) {
            GoodsBean goodsBean = mGoodLists.get(position);
            Intent data = new Intent();

            data.putExtra("goodsBean", goodsBean);

            setResult(ConstantValues.ACTIVITY_SELECT_GOODS_SUCCESS_CODE, data);
        }
    }

First Activity

 if (resultCode == ConstantValues.ACTIVITY_SELECT_GOODS_SUCCESS_CODE) {
            if (data != null) {
                GoodsBean goodsBean = (GoodsBean) data.getSerializableExtra("goodsBean");
            }
        }

solutions

The entity class goodsbean refers to the uniuserbean, so we should not only serialize the goodsbean, but also the uniuserbean

Similar Posts: