0

I want to make google maps api to provide result of search by category as the nearest hotels available in certain range and i want also to control range , here is the code i started with , this code search when the use apply an address . i want this this to done when the user enter a certain category not by entering an address

protected void search(List<Address> addresses) {

Address address = (Address) addresses.get(0);
home_long = address.getLongitude();
home_lat = address.getLatitude();
latLng = new LatLng(address.getLatitude(), address.getLongitude());

addressText = String.format(
        "%s, %s",
        address.getMaxAddressLineIndex() > 0 ? address
                .getAddressLine(0) : "", address.getCountryName());

markerOptions = new MarkerOptions();

markerOptions.position(latLng);
markerOptions.title(addressText);

map1.clear();
map1.addMarker(markerOptions);
map1.moveCamera(CameraUpdateFactory.newLatLng(latLng));
map1.animateCamera(CameraUpdateFactory.zoomTo(15));
locationTv.setText("Latitude:" + address.getLatitude() + ", Longitude:"
        + address.getLongitude());
 }

what the modification needed to be done in this code ?

MrUpsidown
  • 21,592
  • 15
  • 77
  • 131
ahmed osama
  • 297
  • 4
  • 15
  • I want to Search in google maps api by category , by getting the nearest places according to the provided category – ahmed osama Jan 21 '17 at 15:12

1 Answers1

0

You have two options here:

1st option- You build your own DB with all the hotels and their locations, then reflect that on the map.

2nd option- you use Google's Places API. Here is a nice discussion about it.

Hope this helps :)

Community
  • 1
  • 1
MohammedAlSafwan
  • 872
  • 1
  • 8
  • 25