N
N
Nubbin2017-07-29 15:23:24
Android
Nubbin, 2017-07-29 15:23:24

Retrofit2 handler?

Good afternoon.
Here is the code:

ServiceConnector.api.getHomePage().enqueue(new SuccessCallback<Data>() {
        @Override
        public void onResponse(Call<Data> call, @NonNull Response<Data> response) {
            //
        }
    });

   Log.d("return", "plus")

This code calls in the log "return -> plus" shows instantly how to make it so that when the process is running in "onResponse ()" that the lower part of the code is not processed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrei K, 2017-07-29
@1110001111

Do you want the program to stop and wait for retrofit to pull onResponse when executing enqueue(), and then continue working?
If yes, then read about how anonymous classes work and about the observer pattern.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question