Link Details

Link 1147587 thumbnail
User 1114435 avatar

By faheem.sohail
via syntx.io
Published: Apr 30 2014 / 11:13

In this post, we will see how to send an HTTP GET request from android. There are a couple of methods of how you could do this in the Android platform. We will see which one is better under what circumstances. Also, network requests should be made in a new thread, therefore this example sends requests asynchronously.
  • 6
  • 1
  • 403
  • 1941
User 776377 avatar

lburnham123 replied ago:

0 votes Vote down Vote up Reply

When constructing the InputStreamReader, the readStream method should consider the Content-Type header of the HTTP response - otherwise the resulting string might be garbage.

User 1114435 avatar

syntx replied ago:

0 votes Vote down Vote up Reply

@lburnham123 valid point. In my case, i know that response type is always JSON so its not that big an issue.

User 776377 avatar

lburnham123 replied ago:

0 votes Vote down Vote up Reply

What matters here is the encoding, not the data type. Since you didn't say anything about how this article applies to you, and you only, you need to talk about this.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Apache Hadoop
Written by: Piotr Krewski
Featured Refcardz: Top Refcardz:
  1. Play
  2. Akka
  3. Design Patterns
  4. OO JS
  5. Cont. Delivery
  1. Play
  2. Java Performance
  3. Akka
  4. REST
  5. Java