Solução
String api = "Sua URL";
-- Retrofit retrofit = new Retrofit.Builder()
.baseUrl(api)
.addConverterFactory(GsonConverterFactory.create())
.build();
LoadNoticias loadNoticias = retrofit.create(LoadNoticias.class );
Call<ResponseBody> loadNoticiasCall = loadNoticias.getNoticias();
loadNoticiasCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Response<ResponseBody> response) {
if (response.body() != null) {
try {
String json = response.body().string();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public void onFailure(Throwable t) {
}
});
public interface LoadNoticias{
@GET("/seu.json")
Call<ResponseBody> getNoticias();
}
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
0 comentários:
Postar um comentário