2013-04-29 93 views
1

我試圖從遠程服務傳回一個List<Address>對象,我似乎無法弄清楚爲什麼會發生這種情況,但是當我嘗試將import android.location.Address插入到我的Android AIDL文件中時,我的IDE(Eclipse)高亮燈導入爲錯誤。這很奇怪,因爲Address實現了Parcelable接口(android.location.Location也是這樣,因爲它沒有像錯誤那樣被高亮顯示),所以我不希望這樣做。任何想法發生了什麼?android.location.Address不被AIDL識別?

我正在開發的Android平臺是4.2.2 Jelly Bean。

回答

3

雖然android.location.Address實現了Parcelable接口,但它似乎並沒有在sdk/platforms/android-<api-level>/framework.aidl中聲明爲parcelable。作爲一種變通方法,您可以到行添加:

parcelable android.location.Address; 

framework.aidl文件(在4.2.2豆形軟糖的情況下,17)對應的API級別。

另一種方法,我更喜歡直接修改framework.aidl文件,是在src/android/location/Address.aidl添加包含parcelable申報項目的AIDL接口文件,其中包含:

package android.location; 
parcelable Address; 

爲什麼android.location.Address沒有在聲明爲parcelable首先我不知道framework.aidl