I am using the new Google Places SDK: AutocompleteSupportFragment.
whenever i select an address from the result list it doesn't save it and show it on the field.
I am not sure why.
this is my code below: i declaed the variable at the top of the class:
Place shipAddress;
and called this method where i needed:
final AutocompleteSupportFragment editAddress = (AutocompleteSupportFragment) getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment);
editAddress.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME));
editAddress.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
shipAddress = place;
}
@Override
public void onError(Status status) {
Log.e("ERROR", status.getStatusMessage());
}
});
i am also using the result in another method calling:
address = shipAddress.getAddress().toString();
but finally i get an error that variable address is invoked on a null object.