POSTing JSON/XML using android-async-http (loopj)

前端 未结 9 784
广开言路
广开言路 2020-12-02 07:01

I am using android-async-http and really liking it. I\'ve run into a problem with POSTing data. I have to post data to the API in the following format: -

&l         


        
9条回答
  •  自闭症患者
    2020-12-02 07:21

    a better way to post json

    RequestParams params = new RequestParams();
        params.put("id", propertyID);
        params.put("lt", newPoint.latitude);
        params.put("lg", newPoint.longitude);
        params.setUseJsonStreamer(true);
    
        ScaanRestClient restClient = new ScaanRestClient(getApplicationContext());
        restClient.post("/api-builtin/properties/v1.0/edit/location/", params, new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
            }
    
            @Override
            public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
            }
        });
    

提交回复
热议问题