3
I have the following object:
{
  codigo : "1",
  nome   : "Carlos"
}
Java class (POJO)
public class usuario{
   @SerializedName("codigo")
   private int codigo;
   @SerializedName("nome")
   private String nome;
   /* ... */
}
The call
Call<Usuario> getUsuario(@Query("codigo")
What do I call this object using retrofit?
I’m trying like this:
private void getUsuario ( Service service, int codigo ){
        Call<Usuario> userCall = service.getUsuario( codigo );
        userCall.enqueue(new Callback<Usuario>() {
            @Override
            public void onResponse(Call<Usuario> call, Response<Usuario> response) {
                Log.i("User body",response.toString());
                if( response.isSuccessful() ){
                   //Não sei o que fazer 
                }
            }
            @Override
            public void onFailure(Call<Usuario> call, Throwable t) {
                Log.i("onFailure Usuario", t.getMessage());
            }
        });
    }
						
To get the result is Answer.body does like this: User replies service = Answer.body dai tu instance the user class (the POJO you created ) and saves like this: user.setname = answerservice.getname, if it is from a list it is a little different, this is all inside the Answer
– Igor Oliveira
Actually, my lists worked fine
– adventistaam
Your way it worked!
– adventistaam
Can you add as an answer, please
– adventistaam