In this post, you can learn how to make a httpclient for HTTP Get Request to retrieve contents of a stream. Please find below the android source code example.
public static InputStream getInputStreamFromUrl(String url) {
InputStream content = null;
try {
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(new HttpGet(url));
content = response.getEntity().getContent();
} catch (Exception e) {
Log.e("[GET REQUEST]", "Network exception");
}
return content;
}
No comments:
Post a Comment