android Place Autocomplete how to get list of searched place on top by default -
i implement place autocomplete in application , write search keyword in edittext
result according search place keyword. here code start placeautocomplete activity search place
int place_autocomplete_request_code = 1; try { intent intent = new placeautocomplete.intentbuilder(placeautocomplete.mode_fullscreen) .build(this); startactivityforresult(intent, place_autocomplete_request_code); } catch (googleplayservicesrepairableexception e) { } catch (googleplayservicesnotavailableexception e) { }
when activity launch list showing blank.
what want- searched place should show when activity launch uber app
you have persistent autocomplete results within internal app storage (shared preferences, database..) or somewhere want. basically, need implement ui yourself. don't think can customise placeautocomplete.intentbuilder
needs.
implement api-call autocompletegoogleplaces (we using retrofit this)
@get("/maps/api/place/autocomplete/json") call<googleautocompleteresponse> getautocompletesearchresults(@query("key") string apikey, @query("input") string searchterm, @query("location") string location, @query("radius") long radius);
perform call (on enter-click or ontextchange)
public list<googleplaceautocompletegeomodel> getautocompletesearchresults(string searchterm, latlng center, long radius) { call<googleautocompleteresponse> call = googleplacesrestapiservice.getautocompletesearchresults(api_key, searchterm, getlocationstringfrom(center), radius); try { googleautocompleteresponse autocompleteresponse = call.execute().body(); list<googleplaceautocompletegeomodel> autocompleteresponsepredictions = autocompleteresponse.getpredictions(); //here autocomplete objects return autocompleteresponsepredictions; } catch (ioexception e) { l.e("error on google autocomplete call: " + e.getmessage()); } return new arraylist<>(); }
persistent result of autocomplete result
googleautocompleteresponse
within app , implement logic showing results in ui or populated within listview
Comments
Post a Comment