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:
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.
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.
“ 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.”
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With