Yes, I’m late to post about Retrofit, but this post is in my drafts box there is a long time! =D It will not be a big post explaining each detail of this framework even because I’m late (again) and there is already lot of posts doing this job . I will try to do something diferente, resuming the use of Retrofit in a easy way to see how it works.
Step 1 – Implement the Resource
Firstly, we must to create a interface that will represent each resources from the API that will be consumed.
Step 2 – Retrofit Instance
So, we gonna need a Retrofit instance to call this UserResource
Step 3 – Instanciate the Resource
And, we gonna instanciate our UserResource like that:
Easy, isn’t it?
Step 4 – Call
Let’s execute UserResource method listAll() synchronously:
Or we can do it assynchronously:
I will post more details soon!