com.google.android.gms.location.places.ui.PlaceAutocompleteFragment Java Examples

The following examples show how to use com.google.android.gms.location.places.ui.PlaceAutocompleteFragment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocationAlarmActivity.java    From LocationAware with Apache License 2.0 6 votes vote down vote up
private void initView() {
  locationPin = findViewById(R.id.location_pin);
  currentLocationBtn = findViewById(R.id.my_location_btn);
  checkPointsListBtn = findViewById(R.id.check_points_list_btn);
  View bottomSheet = findViewById(R.id.bottom_sheet);
  mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
  mBottomSheetBehavior.setHideable(true);
  mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);

  RecyclerView checkPointsList = findViewById(R.id.check_point_list_view);
  checkPointsList.setLayoutManager(new LinearLayoutManager(context));
  checkPointsList.setAdapter(checkPointsAdapter);
  autocompleteFragment = (PlaceAutocompleteFragment)
      getFragmentManager().findFragmentById(R.id.search_places_fragment);
  SupportMapFragment supportMapFragment =
      (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
  supportMapFragment.getMapAsync(this);
  bindEvents();
}
 
Example #2
Source File: MainActivity.java    From android-play-places with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    // Retrieve the PlaceAutocompleteFragment.
    PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)
            getFragmentManager().findFragmentById(R.id.autocomplete_fragment);

    // Register a listener to receive callbacks when a place has been selected or an error has
    // occurred.
    autocompleteFragment.setOnPlaceSelectedListener(this);

    // Retrieve the TextViews that will display details about the selected place.
    mPlaceDetailsText = (TextView) findViewById(R.id.place_details);
    mPlaceAttribution = (TextView) findViewById(R.id.place_attribution);
}