从Json URL读取Lan,Long并将lat和long分配给map的标记?

时间:2017-06-29 12:12:40

标签: android json google-maps

我是Android新手,我正在尝试从URL读取json文件,并获取lat,并且长,和 将值分配给标记并在地图中显示,我的问题是如何获取局域网,长,读完json的内容? 这是json url数据 URL上的json数据

File

在android中我希望得到lat,long并将每个值分配给市场     地图

{"properties":{"1":{"name":"Villa For 
Sale","lat":"35.2474962142","lng":"-91.3480163353","price":"$100,000","image1":"http:\/\/wpl28.realtyna.com\/theme28\/wp-content\/uploads\/WPL\/91\/thimg_12_800x420.jpg","image2":"http:\/\/wpl28.realtyna.com\/theme28\/wp-content\/uploads\/WPL\/85\/thimg_2_800x420.jpg"},"2":{"name":"Apartment For Rent","lat":"35.9542249162","lng":"-101.21893164","price":"$40,000","image1":"ht

1 个答案:

答案 0 :(得分:0)

获取字符串响应后,只需将其解析为JSONObject,如下面的示例示例&然后你就可以获得Latitude&经度。

JSONObject jsonObj = new JSONObject("{"name":"myName","address":"myAddress"}");
String my_name = jsonObj.getString("myName");