2016-07-25 14 views
1

Ich habe PlaceAutocompleteFragment von Google Places Api verwendet, um die Autocomplete-Suche in meine Android-Anwendung zu integrieren. Es funktioniert gut, aber das Problem ist irgendwann die Ergebnisse in Autocomplete-Liste kommt einer über den anderen. Ich kann nicht über das Problem nachdenken. Ich füge den Screenshot und den Code für das gleiche hinzu.Die Ergebnisse kommen in einem anderen Android-Widget hinzu. PlaceAutocompleteFragment Such-Widget Von Google Places bereitgestellt

Screenshot of the problem

Code -

Layout-Code -

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/coord" 
    android:fitsSystemWindows="true" 
    tools:context="com.restaurantfinder.lazylad91.restaurantfinder.HomeActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:popupTheme="@style/AppTheme.PopupOverlay"> 
      <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" 
       /> 
     </android.support.v7.widget.Toolbar> 
    </android.support.design.widget.AppBarLayout> 

    <include layout="@layout/content_home"/> 

<!-- <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|end" 
     android:layout_margin="@dimen/fab_margin" 
     android:src="@android:drawable/ic_dialog_email"/>--> 

</android.support.design.widget.CoordinatorLayout> 

Aktivitätscode -

AutocompleteFilter typeFilter = new AutocompleteFilter.Builder() 
      .setTypeFilter(AutocompleteFilter.TYPE_FILTER_ESTABLISHMENT) 
      .build(); 
    autocompleteFragment.setFilter(typeFilter); 

    autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() { 
     @Override 
     public void onPlaceSelected(Place place) { 
      // TODO: Get info about the selected place. 
      mPlaceSelected = place; 

      } 
      Log.d("TAG", "Place: " + place.getName());//get place details here 
     } 
+2

Fehlerbericht eingereicht: https://code.google.com/p/gmaps-api-issues/issues/detail?id=10292 – Stuartsoft

+0

Dies ist jetzt in Google Play Services 9.6 für Jellybean und höher behoben. –

Antwort

1

Dies ist ein bekanntes Problem in der Autocomplete-Widget für Android. Es wird in einer kommenden Version behoben werden.

+0

Hast du eine Idee, wann es repariert wird? Still Problem ist herstellbar. Danke, – Ravi

+1

Erwarten Sie die Lösung für diese Mitte September (geben Sie oder nehmen Sie eine Woche). – AndrewR