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.

enter image description here

what want- searched place should show when activity launch uber app

enter image description here

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.

  1. 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); 
  2. 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<>();    } 
  3. persistent result of autocomplete result googleautocompleteresponse within app , implement logic showing results in ui or populated within listview


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -