Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将Android Google Maps JSON位置发送到RESTful web服务_Android_Json_Rest - Fatal编程技术网

如何将Android Google Maps JSON位置发送到RESTful web服务

如何将Android Google Maps JSON位置发送到RESTful web服务,android,json,rest,Android,Json,Rest,我有一个android应用程序,它只需要从带有标记的用户那里获取谷歌地图的位置,然后我想将这些位置发送到网络服务,该服务将再次在网上谷歌地图上使用 简单地说,我只需要将这些Lat和Lng发送到web 如何使用json数据将这些信息发送到web服务器 谢谢 private void parseJSon(String data) throws JSONException { if (data == null) return; List<Route> ro

我有一个android应用程序,它只需要从带有标记的用户那里获取谷歌地图的位置,然后我想将这些位置发送到网络服务,该服务将再次在网上谷歌地图上使用

简单地说,我只需要将这些Lat和Lng发送到web

如何使用json数据将这些信息发送到web服务器

谢谢

private void parseJSon(String data) throws JSONException {
    if (data == null)
        return;

    List<Route> routes = new ArrayList<Route>();
    JSONObject jsonData = new JSONObject(data);
    JSONArray jsonRoutes = jsonData.getJSONArray("routes");
    for (int i = 0; i < jsonRoutes.length(); i++) {
        JSONObject jsonRoute = jsonRoutes.getJSONObject(i);
        Route route = new Route();

        JSONObject overview_polylineJson = jsonRoute.getJSONObject("overview_polyline");
        JSONArray jsonLegs = jsonRoute.getJSONArray("legs");
        JSONObject jsonLeg = jsonLegs.getJSONObject(0);
        JSONObject jsonDistance = jsonLeg.getJSONObject("distance");
        JSONObject jsonDuration = jsonLeg.getJSONObject("duration");
        JSONObject jsonEndLocation = jsonLeg.getJSONObject("end_location");
        JSONObject jsonStartLocation = jsonLeg.getJSONObject("start_location");

        route.distance = new Distance(jsonDistance.getString("text"), jsonDistance.getInt("value"));
        route.duration = new Duration(jsonDuration.getString("text"), jsonDuration.getInt("value"));
        route.endAddress = jsonLeg.getString("end_address");
        route.startAddress = jsonLeg.getString("start_address");
        route.startLocation = new LatLng(jsonStartLocation.getDouble("lat"), jsonStartLocation.getDouble("lng"));
        route.endLocation = new LatLng(jsonEndLocation.getDouble("lat"), jsonEndLocation.getDouble("lng"));
        route.points = decodePolyLine(overview_polylineJson.getString("points"));

        routes.add(route);
private void parseJSon(字符串数据)抛出JSONException{
如果(数据==null)
返回;
列表路由=新建ArrayList();
JSONObject jsonData=新的JSONObject(数据);
JSONArray jsonRoutes=jsonData.getJSONArray(“routes”);
对于(int i=0;i