Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. public void OnMapReady(GoogleMap map)[
  2. //navigate to my current location
  3. }
  4.  
  5.  
  6.  
  7. public void setupPlaces(){
  8. AutocompleteSupportFragment autocompleteFragment = (AutocompleteSupportFragment)
  9. getChildFragmentManager().findFragmentById(R.id.autocomplete_fragment);
  10.  
  11. autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME, Place.Field.LAT_LNG));
  12.  
  13. autocompleteFragment.setLocationBias(RectangularBounds.newInstance(bounds));
  14. autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
  15. @Override
  16. public void onPlaceSelected(Place place) {
  17. Log.i(GlobalVar.TAG, "Place: " + place.getName() + ", " + place.getId());
  18. currentLocation = place.getLatLng();
  19. mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLocation, GlobalVar.MAP_ZOOM));
  20. }
  21.  
  22. @Override
  23. public void onError(Status status) {
  24.  
  25. Log.i(GlobalVar.TAG, "An error occurred: " + status);
  26. }
  27. });
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement