I have developed a HTTP GET Method that clearly works.
public class GetMethodEx {
public String getInternetData() throws Exception{
new TrustAllMa
Take care, with the new version of API all this code is deprecated !
Here is an example of http get with the new api.
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() {
@Override
public void onResponse(String response) {
// Display the first 500 characters of the response string.
mTextView.setText("Response is: "+ response.substring(0,500));
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mTextView.setText("That didn't work!");
}
});
// Add the request to the RequestQueue.
queue.add(stringRequest);
Source from android website : https://developer.android.com/training/volley/simple.html