PlaceOptions placeOptions=new PlaceOptions() {
@Nullable
@Override
public Point proximity() {
return null;
}
@Nullable
@Override
public String language() {
return null;
}
@Override
public int limit() {
return 0;
}
@Nullable
@Override
public Integer historyCount() {
return null;
}
@Nullable
@Override
public String bbox() {
return null;
}
@Nullable
@Override
public String geocodingTypes() {
return null;
}
@Nullable
@Override
public String country() {
return null;
}
@Nullable
@Override
public List<String> injectedPlaces() {
return null;
}
@Override
public int viewMode() {
return 0;
}
@Override
public int backgroundColor() {
return 0;
}
@Override
public int toolbarColor() {
return 0;
}
@Override
public int statusbarColor() {
return 0;
}
@Nullable
@Override
public String hint() {
return null;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
}
};
Intent intent = new PlaceAutocomplete.IntentBuilder()
.accessToken(R.string.token)
.placeOptions(placeOptions)
.build(this);
startActivityForResult(intent, REQUEST_CODE_AUTOCOMPLETE);
I am trying to build custom PlaceAutocomplete, with custom language and country for Serbia. I am getting error about parcelable data, but I am unable to find a solution for a long time. Since I am working with MapBox, everything was easy and there was fully documentation, but for PlaceOptions there is nothing on their site.
Parcelable protocol requires a Parcelable.Creator object called CREATOR on class com.magma.magmataxi.LocationActivity$2
I was thinking that PlaceOptions.builder.build can help, but I am still not able to solve the problem.
You should use PlaceOptions.builder()
See https://docs.mapbox.com/android/plugins/examples/global-location-search/.
Also, be careful about posting your Mapbox token on the internet. It's now "exposed" and could be used by others. I'd rotate your token now so that it's secure.