1

Can i use volley network operations in a separate thread for every network call like this :-

new Thread() {
   @Override
    public void run() {
        // Creating volley request obj
        JsonArrayRequest movieReq = new JsonArrayRequest(url,
                new Response.Listener<JSONArray>() {
                    @Override
                    public void onResponse(JSONArray response) {
                        Log.d(TAG, response.toString());
                 }, new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        VolleyLog.d(TAG, "Error: " + error.getMessage());                       
                    }
                });
    }
 };
Konrad Krakowiak
  • 12,285
  • 11
  • 58
  • 45
Krishan
  • 79
  • 1
  • 1
  • 9

1 Answers1

1

Here is an answer to your question, already posted on StackOverflow https://stackoverflow.com/a/20675142/964152.

Volley does the networking stuff on another thread for you and sends it back to the main thread.

Community
  • 1
  • 1
Flm
  • 271
  • 1
  • 7