简体   繁体   English

在 Android 中使用来自 Google Places API 的 JSON 响应

[英]Using JSON Response from Google Places API in Android

I want to do some application to learn how to work with android and maps.我想做一些应用程序来学习如何使用 android 和地图。 So I want to make something simple, like showing on the map the schools or museums from a given city.所以我想做一些简单的事情,比如在 map 上展示某个城市的学校或博物馆。

I think I have to use the Google Places API, so I read some things about it.我想我必须使用 Google Places API,所以我读了一些关于它的东西。 I saw that I have to make some request to a rest server, and they will return me a json response.我看到我必须向 rest 服务器发出一些请求,他们会返回给我一个 json 响应。 I understand that.我明白那个。 But, what I don't understand is how can I "translate" those json responses into pinpoints on the map.但是,我不明白的是如何将这些 json 响应“翻译”成 map 上的精确点。

If you can guide me to some tutorials or some examples with this, I would appreciate that.如果您能指导我学习一些教程或一些示例,我将不胜感激。 I saw some links right here, on SO, but they were incomplete or not working.我在 SO 上看到了一些链接,但它们不完整或不起作用。

Thanks谢谢

you use the json data as follows: var a=new JSONObject(jsonData);您使用 json 数据如下: var a=new JSONObject(jsonData);

http://developer.android.com/resources/tutorials/views/hello-mapview.html http://developer.android.com/resources/tutorials/views/hello-mapview.html

Use the data from a to constuct the necessary objects and add it to the map.使用 a 中的数据构造必要的对象并将其添加到 map。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM