0

I have added the Place Autocomplete to my app but when I touch the search button it comes and then disappearing. I couldn't type in the search it disappearing. Disappearing means there's search bar but if we touch googles search bar will come out and we can type there. But It's coming and then it suddenly disappears.

This is the code in XML.

<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:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
</android.support.v7.widget.Toolbar>
Sathiyakugan
  • 674
  • 7
  • 20
  • instead of Fragment why U didn't use `AutoCompleteAdapter` and bind it with Place API? – Stuti Kasliwal Sep 29 '17 at 11:19
  • @stutikasliwal documentation doesn't prescribe it.. – Sathiyakugan Sep 29 '17 at 11:29
  • ok, well to understand your code and its problem you have to share activity code as well. using Autocomplete along with Place API will be more convenient and easy to implement, You can try it once – Stuti Kasliwal Sep 29 '17 at 11:35
  • @stutikasliwal I know it very well but the problem is not that I have the problem with disappearing when I clicked the search button. It means another pop-up search button will come and it will ask that's automatically disappearing in a second. This image will give some idea about the auto complete .https://developers.google.com/places/images/acw_overlay.png – Sathiyakugan Sep 29 '17 at 12:49
  • I still have this problem, and I do have the API key in the manifest file. Did you solve the problem? How? – omargamal8 May 07 '18 at 20:30

2 Answers2

0

it's working and Android API key should be added to the manifest! So it will work !https://developers.google.com/places/android-api/

Sathiyakugan
  • 674
  • 7
  • 20
0

I was having the same problem. What caused my problem was the api I was using was old and wasn't registered for an android project. So I registered a new project here https://console.developers.google.com and replaced the old api with the new one. Then it worked.

So basically, what was happening was that when you try to search, the api gets refused by google's servers, so it prevents you from searching.

omargamal8
  • 551
  • 5
  • 12