Best Framework for JSON

Asked

Viewed 118 times

-2

I’m with a project for android and need a framework to exchange information via webservice.

1 answer

2

There is a Google-maintained Volley library that aims to help HTTP communication implementations.

Google provides a documentation page: http://developer.android.com/training/volley/index.html

Example of use:

public void initVolley(Context applicationContext) {
    mRequestQueue = Volley.newRequestQueue(applicationContext);
}

public void doPost(JSONObject jsonObject) {
    JsonObjectRequest request = new JsonObjectRequest(
        Request.Method.POST,
    URL,
    jsonObject,
    new Response.Listener() {
        @Override
        public void onResponse(JSONObject response) {
        // Do something...
        }
    },
    new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
        // Do something...
        }
    });
    mRequestQueue.add(request);
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.