Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change hint text of PlaceAutocomplete.IntentBuilder in Android

I am creating an Android Application. In that I am using PlaceAutocomplete.IntentBuilder to get address from Google.

I want to change the hint text of search box in PlaceAutocomplete view.

I am using below code for opening the PlaceAutocomplete view.

Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY).build(this);
startActivityForResult(intent, requestCode);

Screen shot:

enter image description here

like image 773
Sagar Zala Avatar asked May 30 '16 10:05

Sagar Zala


People also ask

How to change the hint text with autocomplete intent?

Unfortunately, there is no way to change the hint text with the autocomplete intent. You need to make your own widget, like the PlaceAutocompleteFragment. It seems there is no way to change placeholder text with either auto complete activity or even with PlaceAutocompleteFragment because it also use autocomplete activity inside.

How to set hint in edittext in Android programmatically?

Add hint in editText through programming on button click. Application developer can set editText hint via MainActivity.java programming file this feature called as dynamically setting up hint text on button click function. So here is the complete step by step tutorial for Set hint in edittext in android programmatically.

What is autocomplete in places SDK for Android?

“ The autocomplete service in the Places SDK 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.”

How do I launch the autocomplete widget using an intent?

To launch the autocomplete widget using an intent, follow these steps: Use Autocomplete.IntentBuilder to create an intent, passing the desired Autocomplete mode. The intent must call startActivityForResult, passing in a request code that identifies the intent.


1 Answers

For the new Autocomplete.IntentBuilder, you can override the hint string in your strings.xml file.

<string name="places_autocomplete_search_hint">SOME HINT TEXT</string>

I have not tested it on the old PlaceAutocomplete.IntentBuilder, however.

like image 105
rednuht Avatar answered Sep 30 '22 10:09

rednuht