I've already know some of the inner workings of Volley
network library.
//Request a string response from the URL resource
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener() {
@Override
public void onResponse(String response) {
// Display the response string.
txtView.setText("Response is: " + response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
txtView.setText("Oops! That didn’t work!");
}
});
//Instantiate the RequestQueue and add the request to the queue
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
queue.add(stringRequest);
I'm just wondering how does this 2 lines of codes work?
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
queue.add(stringRequest);
It adds my request in the queue
after StringRequest
returns a request? and then the RequestQueue
returns the result and throws it to the onResponse
method?? is that the real flow?