The AutoFill widget service in the Google Places API
for Android does not work as expected. I included a snippet in my xml page, and also added listener activity to my onCreate()
.
Then I start the execution of the autocomplete fragment, I press the first letter of the word I want to find, and suddenly instead of showing sentences, onError()
is executed and closed.
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.akhil.maplocation.MapsActivity" /> <fragment android:id="@+id/place_autocomplete_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" /> </RelativeLayout>
The main activity for this is:
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; LatLng fromadd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment); autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() { @Override public void onPlaceSelected(Place place) {
}
source share