0
点赞
收藏
分享

微信扫一扫

Parcelable encountered IOException


通过使用 ​​public class ItemData implements Serializable {}​​​在通过Intent传递序列化数据的时候提示“​​Parcelable encountered IOException​​”错误。

Parcelable encountered IOException_数据


事实Serializable 什么也没做,只是标记ItemData可以序列化而已。所以在​​implement Serializable​​ 的时候我们需要注意以下两点:

1.ItemData 内部成员必须是可序列化的,否则不行。

2.如果itemdata作为某个包的内部class,需要声明为static。

public class ListAdapter extends RecyclerView.Adapter<ListViewHolder>{
static public class ItemData implements Serializable {}
}


举报

相关推荐

0 条评论