Skip to content

Instantly share code, notes, and snippets.

@msomu
Last active August 29, 2015 14:07
Show Gist options
  • Save msomu/f7d1e3185ea644964540 to your computer and use it in GitHub Desktop.
Save msomu/f7d1e3185ea644964540 to your computer and use it in GitHub Desktop.
Volley Request for String on Android
// Instantiate the RequestQueue.
RequestQueue queue = Volley.newRequestQueue(this);
String url ="http://www.google.com";
// Request a string response from the provided URL.
StringRequest stringRequest = new StringRequest(Request.Method.GET,url,new Response.Listener<String>() {
@Override
public void onResponse(String s) {
Log.d("Response:", s.toString());
pDialog.hide();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
}
});
// Add the request to the RequestQueue.
queue.add(stringRequest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment