How to send POST request in JSON using HTTPClient in Android?

后端 未结 5 1621
别跟我提以往
别跟我提以往 2020-11-22 07:49

I\'m trying to figure out how to POST JSON from Android by using HTTPClient. I\'ve been trying to figure this out for a while, I have found plenty of examples online, but I

5条回答
  •  隐瞒了意图╮
    2020-11-22 08:36

    Too much code for this task, checkout this library https://github.com/kodart/Httpzoid Is uses GSON internally and provides API that works with objects. All JSON details are hidden.

    Http http = HttpFactory.create(context);
    http.get("http://example.com/users")
        .handler(new ResponseHandler() {
            @Override
            public void success(User[] users, HttpResponse response) {
            }
        }).execute();
    

提交回复
热议问题