Android 可包裹-无法从参数化类型中选择

Android 可包裹-无法从参数化类型中选择,android,parcelable,Android,Parcelable,在我的应用程序中,我有一个类,该类包含一个列表,我想将其打包到我尝试过的特定类中 public class FeaturesParcelable implements Parcelable { private List<List<SpinnerModel>> featuresSublist; public List<List<SpinnerModel>> getFeaturesSublist() { return

在我的应用程序中,我有一个类,该类包含一个列表,我想将其
打包到我尝试过的特定类中

public class FeaturesParcelable implements Parcelable {
    private List<List<SpinnerModel>> featuresSublist;

    public List<List<SpinnerModel>> getFeaturesSublist() {
        return featuresSublist;
    }

    public void setFeaturesSublist(List<List<SpinnerModel>> featuresSublist) {
        this.featuresSublist = featuresSublist;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(this.featuresSublist);
    }

    public FeaturesParcelable() {
    }

    protected FeaturesParcelable(Parcel in) {
        this.featuresSublist = new ArrayList<List<SpinnerModel>>();
        in.readList(this.featuresSublist, List<SpinnerModel>.class.getClassLoader());
    }

    public static final Parcelable.Creator<FeaturesParcelable> CREATOR = new Parcelable.Creator<FeaturesParcelable>() {
        @Override
        public FeaturesParcelable createFromParcel(Parcel source) {
            return new FeaturesParcelable(source);
        }

        @Override
        public FeaturesParcelable[] newArray(int size) {
            return new FeaturesParcelable[size];
        }
    };
}
public类功能sparcelable实现可包裹{
私人列表功能列表;
公共列表getFeaturesSublist(){
返回特性列表;
}
公共作废设置功能列表(列表功能列表){
this.featuresSublist=featuresSublist;
}
@凌驾
公共int描述内容(){
返回0;
}
@凌驾
公共无效写入包裹(包裹目的地,内部标志){
dest.writeList(此功能列表);
}
公共功能sparcelable(){
}
受保护的功能可更换(包裹中){
this.featuresSublist=新的ArrayList();
in.readList(this.featuresSublist,List.class.getClassLoader());
}
public static final Parcelable.Creator=新建Parcelable.Creator(){
@凌驾
公共功能Spacelable createFromParcel(地块源){
返回新的特性sparcelable(源);
}
@凌驾
公共功能可拆分[]新数组(整数大小){
返回新功能可升级[大小];
}
};
}
但是我收到一个错误,无法从参数化的类型中进行选择

protected FeaturesParcelable(Parcel in) {
        this.featuresSublist = new ArrayList<List<SpinnerModel>>();
        in.readList(this.featuresSublist, List<SpinnerModel>.class.getClassLoader());
    }
protectedfeaturesparcelable(包裹中){
this.featuresSublist=新的ArrayList();
in.readList(this.featuresSublist,List.class.getClassLoader());
}

1)
列表。class
不能解决您期望的问题。Java使用,因此该语句的运行时类型是
classe,因为接口/泛型在Java中是如何工作的,对于初学者来说,您可能需要一个具体的列表实现,而不是像上面那样使用列表接口。