robospice icon indicating copy to clipboard operation
robospice copied to clipboard

Robospice with Retrofit asynchrone request

Open Deep21 opened this issue 10 years ago • 4 comments

Hello all, I am using robospice with retrofit module to make http request and for some reasons I have to use Asynchrone method with retrofit.

I'am wondering how to use asynchrone method with robospice ? could you please tell me how to declare RetrofitSpiceRequest with asynchrone request ?

Thank you

Deep21 avatar Jan 23 '15 23:01 Deep21

Hello,

Just use SpiceManager methods that take in a SpiceRequest and a ResponseListener<T>. Request is sync/async agnostic. What makes it executed asynchronously is the way you execute it on SpiceManager.

Cheers, Maciej

maciejpigulski avatar Jan 24 '15 08:01 maciejpigulski

Hello @maciejpigulski I'am sorry but I don't get you, could you please give me an example ?

I used this way getSpiceManager().execute(new SpiceRequest , new ResponseListener());

And I dont know how can I put the callback<T> on RetrofitSpiceRequest<T, T>

Deep21 avatar Jan 24 '15 13:01 Deep21

Hello @Deep21 Here are sorts of examples https://github.com/octo-online/RoboSpice-samples

zhangsl avatar Jan 27 '15 08:01 zhangsl

Sorry, I was on vacation.

@Deep21, you don't put anything on the SpiceRequest directly, new ResponseListener() is the callback that will get called with the result from SpiceRequest. Check examples that @zhangsl had pointed you too.

maciejpigulski avatar Jan 28 '15 14:01 maciejpigulski