Answer the question
In order to leave comments, you need to log in
What library to use for asynchronous network requests in android app?
I am learning java and android. I am writing a program that works with an external service via an API.
I found a library for asynchronous requests loopj.com/android-async-http
There are no problems with simple small single requests, but if you try to implement a full-fledged API client, then inefficient places appear, a lot of nested callbacks, parsing the received json in the main application thread, etc. d.
I would like something like this on the click of a button:
void onClick(View v) {
apiClient.getObjects(String param1, new RequestListener() {
onSuccess(Object result) {
//тут в result имеем готовый разобранный ответ от сервиса в виде java объекта
//причем разбор его был отдельном потоке, так как получаемый от сервиса json может быть большим
}
onFailure(Throwable e) {
//тут ошибка
}
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question