その型のオブジェクトを AIDL 経由でリモート サービスに渡すことができるように、内部クラスを Parcelable にする方法を知る必要があります。これに関する情報が見つかりません。
これは私が達成しようとしているコードの例ですが、Bar クラスの CREATOR を静的にできないため (つまり、内部クラスにあるため)、コンパイルされません。Bar を静的内部クラスにすることはできず、Bar を Foo クラスの外 (システム内の他の依存関係) に移動することもできません。また、AIDL ファイル内から Bar クラスを参照する方法も知っておく必要があります。どんな助けでも大歓迎です。
public class Foo implements Parcelable
{
private int a;
public Foo()
{
}
public Foo(Parcel source)
{
this.a = source.readInt();
}
public int describeContents()
{
return 0;
}
public void writeToParcel(Parcel dest, int flags)
{
dest.writeInt(this.a);
}
public static final Parcelable.Creator<Foo> CREATOR
= new Parcelable.Creator<Foo>()
{
...
}
public class Bar implements Parcelable
{
private int b;
public Bar()
{
}
public Bar(Parcel source)
{
this.b = source.readInt();
}
public int describeContents()
{
return 0;
}
public void writeToParcel(Parcel dest, int flags)
{
dest.writeInt(this.b);
}
public static final Parcelable.Creator<Bar> CREATOR
= new Parcelable.Creator<Bar>()
{
...
}
}
}