Here are the examples of the java api class taken from open source projects.

1. MainActivity#onCreate()

View license
protected void onCreate(Bundle savedInstanceState) {
    // Retrieve the PlaceAutocompleteFragment.
    PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getFragmentManager().findFragmentById(;
    // Register a listener to receive callbacks when a place has been selected or an error has
    // occurred.
    // Retrieve the TextViews that will display details about the selected place.
    mPlaceDetailsText = (TextView) findViewById(;
    mPlaceAttribution = (TextView) findViewById(;