Last active
August 29, 2015 14:07
-
-
Save msomu/f7d1e3185ea644964540 to your computer and use it in GitHub Desktop.
Volley Request for String on Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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