Dario
Dario

Reputation: 2073

It is possible to run Robospice listener in non UI thread?

I'm considering using robospice library. From the documentation/samples i see that requests are executed in background thread and listeners in UI thread.

I'm wondering if there is a possibility to run listeners through robospice on non UI thread?

Let's say I have requests A and B and listeners (that can be executed on robospice) in case where for e.g. request B depends on results of request A. So when A is finished, it's listener executes request B. That is ok, but in case if i want to read part of file, which is used for request B, then this is blocking UI for few ms, because listener of A is executed on UI thread.

I can solve this with using for e.g. HandlerThread, but i don't like that then UI will behave as some kind of proxy between A and B.

So, it is possible to run robospice listeners outside of UI thread?

Upvotes: 3

Views: 363

Answers (1)

Snicolas
Snicolas

Reputation: 38168

No, that's not possible easily in RoboSpice.

The only way to do it would be to create a new SpiceService of your own and pass it a custom RequestProcessor with a custom DefaultRequestListenerNotifier.

What is your use case ?

Upvotes: 2

Related Questions