Bui Quang Huy Bui Quang Huy - 1 year ago 90
JSON Question

Which better to get Json between Retrofit 2 and HttpUrlConnection

I know two of it can be used to send http request and get the response from the server, then we can parse into Json object if we want. So:

  • Which is the best way to send request and get response from the server,
    Retrofit 2

  • Which is advantage and disadvantage between them?

Answer Source

Retrofit 2 and Volley are both great networking libraries for modern Android apps, but each has its own strengths that are worth weighing for critical projects. Use Retrofit if your use-case is a standard REST API with JSON responses and not too many custom requirements in terms of caching, request prioritization, retries, etc. Use Volley if you have unusual / fine-grained requirements, or if you anticipate needing a lot of flexibility from your networking layer in the future at the cost of more code. Use neither if you're downloading large files or streaming -- for that, use DownloadManager instead.

Note: HttpClient is deprecated Now

Need More, Find it here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download