stephanenicolas / robospice

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
Apache License 2.0
2.95k stars 545 forks source link

Robospice with Retrofit asynchrone request #400

Open Deep21 opened 9 years ago

Deep21 commented 9 years ago

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

maciejpigulski commented 9 years ago

Hello,

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

Cheers, Maciej

Deep21 commented 9 years ago

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 on RetrofitSpiceRequest<T, T>

zhangsl commented 9 years ago

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

maciejpigulski commented 9 years ago

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.