Ad
How To Set Filter For AutocompleteSupportFragment Api Updated After Jan 2019
how to set filter for country for AutocompleteSupportFragment autocomplete edittext place api with
AutocompleteFilter typeFilter = new AutocompleteFilter.Builder().setCountry("IN").build();
not working with new release of google api for place location for AutocompleteSupportFragment.
xml file
fragment
android:id="@+id/autocomplete_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.google.android.libraries.places.widget.AutocompleteSupportFragment"
java file
AutocompleteSupportFragment autocompleteFragment = (AutocompleteSupportFragment)
getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment);
Ad
Answer
use this:
autocompleteFragment.setCountry("IN");
textView without intent it is also useful:
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override public void onPlaceSelected(Place place) {
txtVw.setText(place.getName()+" >> "+place.getLatLng());
}
@Override public void onError(Status status) {
txtVw.setText(status.toString());
}
}
);
Ad
source: stackoverflow.com
Related Questions
- → should I choose reactjs+f7 or f7+vue.js?
- → Phonegap Android write to sd card
- → Local reference jquery script in nanohttpd (Android)
- → Click to navigate on mobile devices
- → How to allow api access to android or ios app only(laravel)?
- → Access the Camera and CameraRoll on Android using React Native?
- → React native change listening port
- → What is the default unit of style in React Native?
- → Google play market autocomplete icon
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → Using Laravel with Genymotion
- → react native using like web-based ajax function
- → react native pdf View
Ad