Retrieving the Google Place Object - [Android Google Maps Course]

  Рет қаралды 36,750

CodingWithMitch

CodingWithMitch

Күн бұрын

Пікірлер
@couches
@couches 6 жыл бұрын
"Usually you can't get away with writing that much code without getting some kind of issue." I've never heard something this true
@bodieernest6546
@bodieernest6546 3 жыл бұрын
i realize it's kinda off topic but do anybody know of a good place to watch newly released series online?
@elliottbrendan9788
@elliottbrendan9788 3 жыл бұрын
@Bodie Ernest i watch on FlixZone. Just google for it :)
@gaoyunlong9403
@gaoyunlong9403 6 жыл бұрын
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.
@gaoyunlong9403
@gaoyunlong9403 6 жыл бұрын
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"); } } };
@idkeidekn
@idkeidekn 6 жыл бұрын
thats what happened to me too, thank you GAO
@TheLunarah
@TheLunarah 6 жыл бұрын
thaaaaanks!
@C4C4NDY
@C4C4NDY 5 жыл бұрын
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?
@chiraggupta8165
@chiraggupta8165 5 жыл бұрын
How can I show suggestion list in a horizontal recyclerview below search bar
@aliakkawi4759
@aliakkawi4759 7 жыл бұрын
Thanks a lot , your videos are awesome. Looking forward for more and more of your courses.
@cesarpantoja1099
@cesarpantoja1099 5 жыл бұрын
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 ?
@wyndhamwoo2851
@wyndhamwoo2851 3 жыл бұрын
did you find a solution
@tripbuddy6048
@tripbuddy6048 5 жыл бұрын
how can iget the photoreference ?
@ФилиппПересветов
@ФилиппПересветов 6 жыл бұрын
Mitch Thanks for excellent tutorial, pls answer are there any way to sort results in autocomplete by distance?
@codingwithmitch
@codingwithmitch 6 жыл бұрын
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)
@karolinacabaj1668
@karolinacabaj1668 5 жыл бұрын
Hi Mitch, can you provide new version using com.google.android.libraries.places.api.model.Place; ? I have a problem with adding AdapterView.OnItemClickListener
@shyngysrakhad5499
@shyngysrakhad5499 6 жыл бұрын
Is there another way to get placeID?
@hrishikeshrajwade2387
@hrishikeshrajwade2387 6 жыл бұрын
How to Add google reviews about a place to your app?
@gulsheng7657
@gulsheng7657 6 жыл бұрын
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....
@tesario6039
@tesario6039 6 жыл бұрын
I've got Telephone Numer: nul and same for Internet and Price Rating, i don't find the Problem. Can any body help me?
@ak40923
@ak40923 5 жыл бұрын
Hey bro, Now this time "Places.GeoDataApi" is deprecated. How can i resolve it?
@wyndhamwoo2851
@wyndhamwoo2851 3 жыл бұрын
did you find a solution
@dom2760
@dom2760 7 жыл бұрын
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.
@dom2760
@dom2760 7 жыл бұрын
delete "package com.example.dmckoy.myapplication.share" ? i'm lost when you say delete that line of code
@dom2760
@dom2760 7 жыл бұрын
no, that didn't work. i deleted that line, but idn't work
@dom2760
@dom2760 7 жыл бұрын
it's already imported "import com.example.d.myapplication.R; "but for some reason that line of the import is grayed out
@dom2760
@dom2760 7 жыл бұрын
i figured it out, i forgot to input "fragment_gallery" in the GalleryFragment
@bahaagirga1985
@bahaagirga1985 6 жыл бұрын
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.
@gulsheng7657
@gulsheng7657 6 жыл бұрын
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".
@Stefano205291
@Stefano205291 5 жыл бұрын
I have seen that some imports are deprecated. Does anyone have an updated version of PlaceAutocompleteAdapter? Ps your tutorials are amazing!
@bejugamsumanth9399
@bejugamsumanth9399 5 жыл бұрын
Yeah its deprecated.I made a widget as given in website.That works too.
@wyndhamwoo2851
@wyndhamwoo2851 3 жыл бұрын
did you find a solution
@wyndhamwoo2851
@wyndhamwoo2851 3 жыл бұрын
@@bejugamsumanth9399 how do you do this
@LuluLolitta
@LuluLolitta 6 жыл бұрын
moveCamera(new LatLng(place.getViewport().getCenter().latitude, place.getViewport().getCenter().longitude),DEFAULT_ZOOM,mPlace.getName()); is not working for me , help please
@markdelrosario4231
@markdelrosario4231 6 жыл бұрын
cannot resolve symbol AutoCompletePrediction how can i fix this please someone help me thanks...
@wyndhamwoo2851
@wyndhamwoo2851 3 жыл бұрын
did you find a solution
@TheMinino123
@TheMinino123 6 жыл бұрын
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!!
@exaz8103
@exaz8103 6 жыл бұрын
Error contacting API: Status{status code=NETWORK_ERROR, resolution=null} getting this error, anyone who knows the reason? thanks in advance...
@labrucine
@labrucine 6 жыл бұрын
You probably don't have internet connection, that's why it is failing to access Google API SERVER
@ammararasheed7502
@ammararasheed7502 5 жыл бұрын
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
@geraldtugon8463
@geraldtugon8463 5 жыл бұрын
Same error....did you solve the error??
@wyndhamwoo2851
@wyndhamwoo2851 3 жыл бұрын
did you find a solution
@wyndhamwoo2851
@wyndhamwoo2851 3 жыл бұрын
@@geraldtugon8463 did you find a solution
@shankarsalesforceseries5196
@shankarsalesforceseries5196 6 жыл бұрын
I think better we can keep getLatLang in second position after getName to avoid NullPointerException. Because, name and LatLng can't be null.
@gulsheng7657
@gulsheng7657 6 жыл бұрын
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".
@cforge2411
@cforge2411 6 жыл бұрын
at 2x speed, it was chip'n'dale lol
Map Marker and Info Window - [Android Google Maps Course]
9:32
CodingWithMitch
Рет қаралды 41 М.
Kerbal Space Program 2 Was Murdered.
11:26
Bellular News
Рет қаралды 41 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
Saving User GPS Coordinates in a Database
17:26
CodingWithMitch
Рет қаралды 59 М.
DO NOT do this in a Software Engineering Interview
7:59
CodingWithMitch
Рет қаралды 9 М.
Creating Custom Google Map Markers
21:04
CodingWithMitch
Рет қаралды 45 М.
Android app to Track your location using Google Map API
27:38
The Biggest AI News This Month
12:10
AI Uncovered
Рет қаралды 258
go is great i hate it
14:44
SST
Рет қаралды 22 М.
iOS Development is Easier than Android Development (VLOG)
20:41
CodingWithMitch
Рет қаралды 52 М.