按类别搜索 Google 个地图

Search In Google Maps By Category

我想制作 google 地图 api 以提供按类别搜索的结果作为特定范围内最近的酒店,我还想控制范围,这是我开始的代码,此代码在使用申请地址时搜索。我希望在用户输入某个类别时完成此操作,而不是通过输入地址

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());
 }

这段代码需要做哪些修改?

这里有两个选择:

第一种选择 - 您使用所有酒店及其位置构建自己的数据库,然后将其反映在地图上。

第二个选项 - 你用 Google's Places API. Here is a nice discussion 关于它。

希望这对您有所帮助:)