内部クラスParcelableを作成して、その型のオブジェクトをAIDL経由でリモートサービスに渡す方法を知っておく必要があります。私はこれに関する情報を見つけることができません。内部クラスを作成する方法Parcelable
ここでは私が達成しようとしているコードの例ですが、BarクラスのCREATORは静的ではないため(つまり内部クラスにあるため)、コンパイルされません。私はBarを静的な内部クラスにすることはできません.Fooクラスの外にBarを移動することはできません(システム内の他の依存関係)。また、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>()
{
...
}
}
}
あなたはこれがお手伝いしますhttp://stackoverflow.com/questions/35923039/android-implementing-parcelable-inner-classに見てみることができます。 – chaitanya
この解決策を見てください。これはあなたを助けますhttp://stackoverflow.com/questions/35923039/android-implementing-parcelable-inner-class – chaitanya