2017-05-01 6 views
0
return "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" 
      +lat+','+lng 
      + "&radius=" +radius 
      + "&types=" + "food,hospital" //??? 
      + "&type=point_of_interest&key=KEY"; 

私は近くの病院や食べ物をどのように手に入れることができますか?私は "" &タイプ=」+ "食品、病院を" 使用していますが、これは私に私の近くの場所のすべての種類を提供しますGoogle Places APIを使用して2種類の場所を検索するにはどうすればよいですか?

は、あなたの答えをありがとう

答えて

0

使用してみてください:。。

String types = "food|hospital"; -- the pipe symbol 

コード内:

String URL = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="; 
String types = "food|hospital"; 
String key = "your_key"; 
try { 
     placesSearchStr = URL +lat+ "," +lng+ 
         "&radius=1000&sensor=false&types="+URLEncoder.encode(types,"UTF-8")+ 
         "&key="+key; 
     return placesSearchStr; 
    } catch (UnsupportedEncodingException e) { 
     e.printStackTrace(); 
    } 
+0

したがって、 'の代わりに' | 'を使用してください。 :) ありがとうございました! – user3575965

関連する問題