Bui Quang Huy
Bui Quang Huy

Reputation: 1794

Turn asynchronous method to synchronous method in android

I have some method that is asynchronous so I cannot get response value from it to use in other place (in this case is Retrofit call back method). So do we have any way to change the asynchronous method to synchronous method and get values from it?

Upvotes: 2

Views: 1946

Answers (2)

josephus
josephus

Reputation: 8304

Retrofit should have synchronous counterparts to asynchronous calls. Check out this tutorial.

Upvotes: 1

Haven
Haven

Reputation: 546

You just handle result in asynchronous callback then dispatch it to something else to process on business logic, for example a Controller.

Upvotes: 2

Related Questions