LEE
LEE

Reputation: 3605

Retrofit show progress dialog

For native android Async tasks, we had preExecute() method in which we used to show progress dialogs with spinners. Incase of retrofit, where should i put the progress dialog code?

Upvotes: 1

Views: 2646

Answers (2)

Mstack
Mstack

Reputation: 321

Follow the documentation.

    @Override
    public void success(String s, Response response) {
        // do something with success 

    }

    @Override
    public void failure(RetrofitError retrofitError) {
        // do something with failure 
    }

Upvotes: 0

LEE
LEE

Reputation: 3605

I was already using the success and failure methods. Actually it was quite easy. Just make the progress bar visible on the event that you are calling and then later once the view that you want to show post onsuccess method is visible, put the progress bar visibility to gone.

Upvotes: 1

Related Questions