the API docs tells me Geopoint
has a constuctor with two params: latitude, longitude. Both attributes have getters. So either you obtain those and put them in the Bundle
, or you extend the class and make it parcellable, or make a wrapper class. Either solution will work just fine.
Try this, I suspect it'll work just fine.
public class ParcelableGeoPoint implements Parcelable {
private GeoPoint point;
public ParcelableGeoPoint(int lat, int lon){
point = new GeoPoint(lat, lon);
}
public ParcelableGeoPoint(Parcel in){
int[] data = new int[2];
in.readIntArray(data);
point = new GeoPoint(data[0], data[1]);
}
public int describeContents(){
return 0;
}
public GeoPoint unwrap() {
return point;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeIntArray(new int[] {point.getLat(), point.getLon()});
}
public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
public ParcelableGeoPoint createFromParcel(Parcel in) {
return new ParcelableGeoPoint(in);
}
public ParcelableGeoPoint[] newArray(int size) {
return new ParcelableGeoPoint[size];
}
};
}
Then, put it in your Bundle
with bundle.putParcelable("MYPOINT", geopointParcelable)