Restrict Places Autocomplete API to cities of specific country android

前端 未结 4 1874
余生分开走
余生分开走 2021-02-13 12:49

I am using PlaceAutocompleteApi from Play Services, what I want to do is restrict auto-complete to specific country & city only. Eg. All cities from lets say In

4条回答
  •  情歌与酒
    2021-02-13 13:29

    Filter results by country

    // Create Filter
    AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
        .setCountry("AU")
        .build();
    // Attach to autocomplete fragment / widget
    autocompleteFragment.setFilter(typeFilter);
    

提交回复
热议问题