Reputation: 1280
I am a newbie to android and google maps. Basically, I want to provide a search bar besided my mapview to users. The search bar should enable user to search for restaurants. I tried using the google autocomplete API . However, when I type one character to it, it returns null .
The code for my layout xml is :
<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"/>
And I am simply loading this xml from my fragment class. Do I need to do anything in my fragment class to make this work?
Thanks a lot.
Upvotes: 0
Views: 1867
Reputation: 71
I went to postman and paste the query to see what result do I get. Apparently, I didn't enable Billing in Google Cloud Platform.
Possible Solution:
Upvotes: 0
Reputation: 7741
There are many tutorials on the internet that can help you with your problem. From the Google documentation itself, they have a guideline on what autocomplete can do plus some sample code. The autocomplete service in the Google Places API for Android returns place predictions in response to user search queries. As the user types, the autocomplete service returns suggestions for places such as businesses, addresses and points of interest.
You can add autocomplete to your app in the following ways:
Add an autocomplete widget to save development time and ensure a consistent user experience.
Get place predictions programmatically to create a customized user experience.
Just check the documentation above for more information.
For the different tutorials, you can follow either of these:
Android – AutoCompleteTextView with Google Places Autocomplete API
Google Place API Autocomplete Service in Android Application
Upvotes: 0