Networking Basics with Retrofit

Retrofit is an open-source library created and maintained by Square (​retrofit). Under the hood, it uses the OkHttp library as its HTTP client (​okhttp).

Retrofit helps you build an HTTP gateway class. You write an interface with annotated instance methods, and Retrofit creates the implementation. Retrofit’s implementation handles making an HTTP request and parsing the HTTP response into an OkHttp.ResponseBody. But this is limiting: It would be better if you could work with your app’s data types. To support this, Retrofit lets you register a response converter, which Retrofit then uses to marshal your data types into the request and un-marshal your data types from the ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.