지금까지 나는 Parcelable
개체를 문제없이 살펴 보았습니다. 주로 모든 구성원의 메서드가 writeX()
개의 메서드와 연결되어 있기 때문에 문제가 없습니다.개체를 소포로 작성
public String name;
private Foo(final Parcel in) {
name = in.readString(); }
public void writeToParcel(final Parcel dest, final int flags) {
dest.writeString(name); }
하지만 지금은 Bar
회원 일들이 나를 위해 조금 위험한를 얻을 수있는 경우 : 예를 들어, 내가 할
public Bar bar;
private Foo(final Parcel in) {
bar = new Bar(); //or i could actually write some constructor for Bar, this is a demo.
bar.memberString = in.readString();
}
public void writeToParcel(final Parcel dest, final int flags) {
// What do I do here?
}
난이 잘못된 방향으로 접근하는 건가요? 소화물 구성원 Bar
s에 내 writeToParcel
에서 무엇을해야합니까?
일부는 여기에 혼란을 얻을 수 있기 때문에 ** getClass(). getClassLoader를가() ** 의미 추가 ** Bar.class.getClassLoader() ** – Juni
내 클래스가 SDK에 의해 제공되며 수정할 수없는 경우 어떻게해야합니까 무엇 ? – Eido95