Currently I am developing an android applicaiton.
From my collection data, I have a list of location ( not address)- only name of location ( such as name of restaurant, resort, beach...), I want to find address of each location on Google Map API as the below image:

How I can do it ?
I appreciate your help in this case. Thanks.
I'm also looking for a way to do it but I only find the solution to get Latitude or Longitude from specific address or in contrast.
I implemented as the below code but not result can be returned :(
Geocoder coder = new Geocoder(this);
List<Address> address;
try {
String locationName = "Nhà hàng Blanchy Street, VietNam";
Geocoder gc = new Geocoder(this);
List<Address> addressList = coder.getFromLocationName(locationName, 5);
Address location = addressList.get(0);
double latitude = location.getLatitude();
double longitude = location.getLongitude();
LatLng sydney = new LatLng(latitude , longitude );
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13));
On your computer, open Google Maps and make sure you're signed in. Search for a contact's name or address. Matching contacts will appear in the suggestions. To see your contact on the map, choose a name or address.
You can trace a path or highlight an area on your map by drawing lines and shapes.
There is a Geocoder class, which you can use to find the address by location name String. The method is
Geocoder gc = new Geocoder(context);
List<Address> addresses = gc.getFromLocationName(String locationName, int maxResults);
This will give you a list of Address objects. Address has methods getLongitude() and getLatitude(), among others.
And since your map is embedded, the GoogleMap class has a method moveCamera(...) to go the location, if any is found with your location name.
For example:
String locationName = "Nha Hang restaurant";
Geocoder gc = new Geocoder(context);
List<Address> addressList = gc.getFromLocationName(locationName, 5);
Then either use the Address or get the longitude and latitude to create CameraUpdate with CameraUpdateFactory. With this try the moveCamera(...) if you wish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With