AutocompleteFragment

public class AutocompleteFragment extends Fragment


A fragment that provides auto-completion for places.

Use this class only if you are embedding this fragment in an Activity. For embedding in a androidx.fragment.app.FragmentActivity, use AutocompleteSupportFragment.

Summary

Public constructors

Public methods

void
onActivityResult(int requestCode, int resultCode, @Nullable Intent data)

This method is deprecated.

View
onCreateView(
    LayoutInflater inflater,
    @Nullable ViewGroup container,
    @Nullable Bundle savedInstanceState
)

This method is deprecated.

void

This method is deprecated.

void

Restricts the autocomplete results to a particular country.

void

Sets the hint text to display in the search input field when there is no text entered.

void

Biases the autocomplete results to a particular area.

void
setLocationRestriction(
    @Nullable LocationRestriction locationRestriction
)

Restricts the autocomplete results to a particular area.

void

Sets a listener that will be notified when a place is selected.

void

Sets the desired fields of the Place object returned from selecting an autocomplete result.

void

Sets the text to display in the search input field.

void

Restricts the autocomplete results to the given place type.

Inherited Constants

From android.content.ComponentCallbacks2
static final int
static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

This field is deprecated.

static final int

Inherited methods

From android.app.Fragment
void
dump(String p, FileDescriptor p1, PrintWriter p2, String[] p3)

This method is deprecated.

final boolean

This method is deprecated.

final Activity

This method is deprecated.

boolean

This method is deprecated.

boolean

This method is deprecated.

final Bundle

This method is deprecated.

final FragmentManager

This method is deprecated.

Context

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

final FragmentManager

This method is deprecated.

final Object

This method is deprecated.

final int

This method is deprecated.

final LayoutInflater

This method is deprecated.

LoaderManager

This method is deprecated.

final Fragment

This method is deprecated.

Transition

This method is deprecated.

final Resources

This method is deprecated.

final boolean

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

final String
getString(int p)

This method is deprecated.

final String

This method is deprecated.

final Fragment

This method is deprecated.

final int

This method is deprecated.

final CharSequence
getText(int p)

This method is deprecated.

boolean

This method is deprecated.

View

This method is deprecated.

final int

This method is deprecated.

static Fragment

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

boolean

This method is deprecated.

void

This method is deprecated.

Animator
onCreateAnimator(int p, boolean p1, int p2)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

LayoutInflater

This method is deprecated.

void
onHiddenChanged(boolean p)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

boolean

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
onRequestPermissionsResult(int p, String[] p1, int[] p2)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
onTrimMemory(int p)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

final void
requestPermissions(String[] p, int p1)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
setHasOptionsMenu(boolean p)

This method is deprecated.

void

This method is deprecated.

void
setMenuVisibility(boolean p)

This method is deprecated.

void

This method is deprecated.

void
setRetainInstance(boolean p)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
setUserVisibleHint(boolean p)

This method is deprecated.

boolean

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
startIntentSenderForResult(
    IntentSender p,
    int p1,
    Intent p2,
    int p3,
    int p4,
    int p5,
    Bundle p6
)

This method is deprecated.

void

This method is deprecated.

String

This method is deprecated.

void

This method is deprecated.

Public constructors

AutocompleteFragment

public AutocompleteFragment()

Public methods

onActivityResult

public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)

onCreateView

public View onCreateView(
    LayoutInflater inflater,
    @Nullable ViewGroup container,
    @Nullable Bundle savedInstanceState
)

onDestroyView

public void onDestroyView()

setCountry

public void setCountry(@Nullable String country)

Restricts the autocomplete results to a particular country.

setHint

public void setHint(@Nullable CharSequence hint)

Sets the hint text to display in the search input field when there is no text entered.

If the hint is unset or explicitly set to null, the hint text will be set to the default value.

setLocationBias

public void setLocationBias(@Nullable LocationBias locationBias)

Biases the autocomplete results to a particular area.

setLocationRestriction

public void setLocationRestriction(
    @Nullable LocationRestriction locationRestriction
)

Restricts the autocomplete results to a particular area.

setOnPlaceSelectedListener

public void setOnPlaceSelectedListener(@Nullable PlaceSelectionListener listener)

Sets a listener that will be notified when a place is selected.

Parameters
@Nullable PlaceSelectionListener listener

The listener that should be notified.

setPlaceFields

public void setPlaceFields(List<Place.Field> placeFields)

Sets the desired fields of the Place object returned from selecting an autocomplete result.

Read more about Place Data Fields.

setText

public void setText(@Nullable CharSequence text)

Sets the text to display in the search input field.

setTypeFilter

public void setTypeFilter(@Nullable TypeFilter typeFilter)

Restricts the autocomplete results to the given place type.