【发布时间】:2016-09-25 13:57:11
【问题描述】:
我有一个包含另一个对象的对象,我想使用 parcelable 从一个片段发送到另一个片段,例如:
Fragment fragment = new Fragment();
Bundle bundle = new Bundle();
bundle.putParcelable(mykey, Parcels.wrap(MySubObj));
fragment.setArguments(bundle);
MyObj 的 POJO 结构:
class MyObj {
String value;
MySubObj value2;
//geters & seters
@Parcel
class MySubObj {
String name;
int age;
ActivityDomain acdomani;
//geters & seters
@Parcel
public class ActivityDomain {
String name;
String field;
int countEmpl;
//geters & seters
}
}
}
所以在Parcels.wrap(MySubObj) 我收到了这个错误:
org.parceler.ParcelerRuntimeException: Unable to find generated Parcelable class for com.mypakage.MyObj$MySubObj , verify that your class is configured properly and that the Parcelable class com.mypakage.MyObj$MySubObj$$Parcelable is generated by Parceler.
我错过了什么?
【问题讨论】:
标签: java android parcelable parcel