Created
March 6, 2017 21:27
-
-
Save kakobotasso/a824daeb7b763b863323016ba1d33461 to your computer and use it in GitHub Desktop.
Exemplo de uso da lib Retrofit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//URL | |
/usuarios/rafa@gmail | |
// JAVA CLASS | |
public class Usuario{ | |
String nome | |
String email | |
// TODOS OS ATRIBUTOS QUE VEM NO JSON | |
} | |
// RETROFIT | |
@GET("/usuarios/{email}") | |
Call<Usuario> <NOME_DO_METODO>(@Path("email") String email); | |
// CHAMADA | |
Call<Usuario> usuario = service.NOME_DO_METODO("rafa@gmail"); | |
usuario.enqueue( ... ) | |
// No onSuccess do método enqueue, se vc der um response.body() já o usuário que foi buscado no banco |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment