开发者

Android: how to Parcel complex classes and their subclasses

开发者 https://www.devze.com 2023-03-30 00:27 出处:网络
Supose these simple classes: public class Class_A { // no fields } public class Class_B extends Class_A { public float field_1;

Supose these simple classes:

public class Class_A
{
    // no fields
}

public class Class_B extends Class_A
{
    public float field_1;
    public String / int / float / etc...; // dozens of fields
    public int field_N;
}

public class Class_C extends Class_A
{
    public int field_1;
    pu开发者_StackOverflow社区blic String / int / float / etc...; // dozens of fields
    public String field_N;  
}

public class Class_D 
{
    public Class_B class_B;
    public Class_C class_D;
}

1) Is it possible to parcel Class_B / Class_C using reflection in Class_A ? How?

2) How to parcel Class_D ?

3) How to "re-mount" Class_D from Intent after passing it to an Activity ?

0

精彩评论

暂无评论...
验证码 换一张
取 消