R
R
real_mista2017-04-11 19:12:11
Android
real_mista, 2017-04-11 19:12:11

How to get the last observable that was used?

I have a class that has several methods, well, let's say 5 methods in which a request is made about rest api, rxjava , that's all.
In another class, I call these methods and subscribe to them through subscribe and process them. Naturally, I can run into an error, and I need to show an alert dialog - "repeat" and after the "ok" button I have to repeat the observable that was originally. What is the best way to handle such cases? How can you do without saving to the lastUsedObservable variable. Does rxjava cache the last used observable?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tiberal, 2017-04-12
@Tiberal

If the observable fails, then how would he all become a hero. On repeat, you need to create a new one. You can attach a retry operator to the observable, which will try to restart it several times, but then you still need a new one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question