"Usually you can't get away with writing that much code without getting some kind of issue." I've never heard something this true
@bodieernest65463 жыл бұрын
i realize it's kinda off topic but do anybody know of a good place to watch newly released series online?
@elliottbrendan97883 жыл бұрын
@Bodie Ernest i watch on FlixZone. Just google for it :)
@gaoyunlong94036 жыл бұрын
Hi Mitch,cuz last video I used GeoDataClient(no GoogleApiClient used) which means I cant use PendingResult placeResult = Places.GeoDataApi .getPlaceById(mGoogleApiClient, placeId); placeResult.setResultCallback(mUpdatePlaceDetailsCallback); in this video,so what should do for this problem.
@gaoyunlong94036 жыл бұрын
I made it! private AdapterView.OnItemClickListener autoCompleteClickListener = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView adapterView, View view, int i, long l) { hideSoftKeyboard(); final AutocompletePrediction item = placeAutocompleteAdapter.getItem(i); final String placeID = item.getPlaceId(); Task placeResult = mGeoDataClient.getPlaceById(placeID); placeResult.addOnCompleteListener(mUpdatePlaceDetailsCallback); } }; private OnCompleteListener mUpdatePlaceDetailsCallback = new OnCompleteListener() { @Override public void onComplete(@NonNull Task task) { if(task.isSuccessful()){ PlaceBufferResponse places = task.getResult(); final Place myPlace = places.get(0); try{ mPlace = new PlaceInfo(); mPlace.setName(myPlace.getName().toString()); mPlace.setAddress(myPlace.getAddress().toString()); mPlace.setAttributions(myPlace.getAttributions().toString()); mPlace.setId(myPlace.getId()); mPlace.setLatlng(myPlace.getLatLng()); mPlace.setRating(myPlace.getRating()); mPlace.setPhoneNumber(myPlace.getPhoneNumber().toString()); mPlace.setWebsiteUri(myPlace.getWebsiteUri()); }catch (NullPointerException e){ Log.e(TAG,e.getMessage()); } moveCamera(myPlace.getLatLng(),DEFAULT_ZOOM,mPlace.getName()); // Log.d(TAG,"place details: "+myPlace.getAttributions()); // Log.d(TAG,"place details: "+myPlace.getViewport()); // Log.d(TAG,"place details: "+myPlace.getPhoneNumber()); // Log.d(TAG,"place details: "+myPlace.getWebsiteUri()); // Log.d(TAG,"place details: "+myPlace.getId()); // Log.d(TAG,"place details: "+myPlace.getAddress()); // Log.d(TAG,"place details: "+myPlace.getLatLng()); places.release(); }else{ Log.e(TAG,"Place not Found"); } } };
@idkeidekn6 жыл бұрын
thats what happened to me too, thank you GAO
@TheLunarah6 жыл бұрын
thaaaaanks!
@C4C4NDY5 жыл бұрын
Hi Gao, in the previous video did you get the location suggestions to work? If so please can you provide some guidance regarding how you used GeoDataClient?
@chiraggupta81655 жыл бұрын
How can I show suggestion list in a horizontal recyclerview below search bar
@aliakkawi47597 жыл бұрын
Thanks a lot , your videos are awesome. Looking forward for more and more of your courses.
@cesarpantoja10995 жыл бұрын
I have an errror E/PlaceAutoCompleteAd: Error getting autocomplete prediction API call: Status{statusCode=PLACES_API_ACCESS_NOT_CONFIGURED, resolution=null}, how I can solve it ?
@wyndhamwoo28513 жыл бұрын
did you find a solution
@tripbuddy60485 жыл бұрын
how can iget the photoreference ?
@ФилиппПересветов6 жыл бұрын
Mitch Thanks for excellent tutorial, pls answer are there any way to sort results in autocomplete by distance?
@codingwithmitch6 жыл бұрын
Thanks. There probably is. But if you can't find something this is what I'd do: 1) Get the LatLng of your location 2) Get the LatLng of each location returned by the auto complete. 3) Create a Triangle with the two points and calculate the hypotenuse. That will give you the distance. 4) Re-order the results based on that distance you calculated
@ФилиппПересветов6 жыл бұрын
CodingWithMitch thanks Mitch,will try it today)
@karolinacabaj16685 жыл бұрын
Hi Mitch, can you provide new version using com.google.android.libraries.places.api.model.Place; ? I have a problem with adding AdapterView.OnItemClickListener
@shyngysrakhad54996 жыл бұрын
Is there another way to get placeID?
@hrishikeshrajwade23876 жыл бұрын
How to Add google reviews about a place to your app?
@gulsheng76576 жыл бұрын
If write and select Item it will show wrong adress,but if search using Enter will show correct(Will have 2 Marker).Why?For Example "Japan".Please help....
@tesario60396 жыл бұрын
I've got Telephone Numer: nul and same for Internet and Price Rating, i don't find the Problem. Can any body help me?
@ak409235 жыл бұрын
Hey bro, Now this time "Places.GeoDataApi" is deprecated. How can i resolve it?
@wyndhamwoo28513 жыл бұрын
did you find a solution
@dom27607 жыл бұрын
I have an issue, i have an Error, "Cannot resolve symbol 'R' ", you have any idea what this issue can be (Instagram Series) and doubled checked to see if your code matches mines, it does.
@dom27607 жыл бұрын
delete "package com.example.dmckoy.myapplication.share" ? i'm lost when you say delete that line of code
@dom27607 жыл бұрын
no, that didn't work. i deleted that line, but idn't work
@dom27607 жыл бұрын
it's already imported "import com.example.d.myapplication.R; "but for some reason that line of the import is grayed out
@dom27607 жыл бұрын
i figured it out, i forgot to input "fragment_gallery" in the GalleryFragment
@bahaagirga19856 жыл бұрын
This tutorial is very useful, but I've a question.. how to search location nearby my current location? I tried to pass LatLng object from getDeviceCurrrent method to mPlaceAutoCompleteAutoAdapter but the object is always null has no latitude and longitude.
@gulsheng76576 жыл бұрын
Hi...Please can u check that....If write and select Item it will show wrong adress,but if search using Enter will show correct(Will have 2 Marker).Why?For Example "Japan".
@Stefano2052915 жыл бұрын
I have seen that some imports are deprecated. Does anyone have an updated version of PlaceAutocompleteAdapter? Ps your tutorials are amazing!
@bejugamsumanth93995 жыл бұрын
Yeah its deprecated.I made a widget as given in website.That works too.
@wyndhamwoo28513 жыл бұрын
did you find a solution
@wyndhamwoo28513 жыл бұрын
@@bejugamsumanth9399 how do you do this
@LuluLolitta6 жыл бұрын
moveCamera(new LatLng(place.getViewport().getCenter().latitude, place.getViewport().getCenter().longitude),DEFAULT_ZOOM,mPlace.getName()); is not working for me , help please
@markdelrosario42316 жыл бұрын
cannot resolve symbol AutoCompletePrediction how can i fix this please someone help me thanks...
@wyndhamwoo28513 жыл бұрын
did you find a solution
@TheMinino1236 жыл бұрын
For the mAutocompleteClickListener Listener, if someone is getting issues obtaining the PendingResult (for newer versions), we can solve it using Task as follows: private AdapterView.OnItemClickListener mAutocompleteClickListener = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView adapterView, View view, int i, long l) { hideSoftKeyboard(); final AutocompletePrediction item = mPlaceAutocompleteAdapter.getItem(i); final String placeId = item.getPlaceId(); Task placeResult = mGeoDataClient.getPlaceById(placeId); placeResult.addOnCompleteListener(mUpdatePlaceDetailsCallback); } }; private OnCompleteListener mUpdatePlaceDetailsCallback = new OnCompleteListener() { @Override public void onComplete(Task task) { try { PlaceBufferResponse places = task.getResult(); // Get the Place object from the buffer. final Place place = places.get(0); mPlace = new PlaceInfo(); mPlace.setId(place.getId()); mPlace.setName(place.getName() == null ? "" : place.getName().toString()); mPlace.setAddress(place.getAddress() == null ? "" : place.getAddress().toString()); mPlace.setAttributions(place.getAttributions() == null ? "" : place.getAttributions().toString()); mPlace.setLatLng(place.getLatLng()); mPlace.setRating(place.getRating()); mPlace.setPhoneNumber(place.getPhoneNumber() == null ? "" : place.getPhoneNumber().toString()); mPlace.setWebsiteUri(place.getWebsiteUri()); Log.d(TAG, "mUpdatePlaceDetailsCallback: Place: " + mPlace); moveCamera(new LatLng(place.getViewport().getCenter().latitude, place.getViewport().getCenter().longitude), DEFAULT_ZOOM, mPlace.getName()); places.release(); } catch(RuntimeRemoteException e) { Log.e(TAG, "mUpdatePlaceDetailsCallback: RuntimeRemoteException: " + e.getMessage()); return; } } }; Thanks Mitch, for these great tutorials!!
@exaz81036 жыл бұрын
Error contacting API: Status{status code=NETWORK_ERROR, resolution=null} getting this error, anyone who knows the reason? thanks in advance...
@labrucine6 жыл бұрын
You probably don't have internet connection, that's why it is failing to access Google API SERVER
@ammararasheed75025 жыл бұрын
Salam sir I have no option of google places api for android . I enable places api and Maps sdk for android but got error Error contacting API: Status{statusCode=PLACES_API_ACCESS_NOT_CONFIGURED,resolution=null} plz help me
@geraldtugon84635 жыл бұрын
Same error....did you solve the error??
@wyndhamwoo28513 жыл бұрын
did you find a solution
@wyndhamwoo28513 жыл бұрын
@@geraldtugon8463 did you find a solution
@shankarsalesforceseries51966 жыл бұрын
I think better we can keep getLatLang in second position after getName to avoid NullPointerException. Because, name and LatLng can't be null.
@gulsheng76576 жыл бұрын
Hi...Please can u check that....If write and select Item it will show wrong adress,but if search using Enter will show correct(Will have 2 Marker).Why?For Example "Japan".