Is it considered a good practice to use RxJava instead of AsyncTask in Android? For example, if I want to make a query to database, which method would be more efficient? And If an activity finishes, does a background thread die?
Asked
Active
Viewed 242 times
0
-
may be first of all you should read beautiful documentation for RxJava http://reactivex.io/ – Pasha Shkaran Feb 01 '17 at 23:12
-
@Drake thank you, but I've read the documentation. To make it clear for everybody at home: I am asking if there is any benefit of using RxJava's Observable as an alternative for AsyncTask? – nullbyte Feb 01 '17 at 23:28
-
3this is mostly opinion-based. It can be argued both ways. – njzk2 Feb 01 '17 at 23:30
-
Query *what* database? Is there an `Observable` Rx-binding for that library? If not, you are stuck writing it yourself or using AsyncTask – OneCricketeer Feb 01 '17 at 23:33
-
"And If an activity finishes, does a background thread die?" -- nope. a thread's lifecycle is not tied to that of an Activity. – homerman Feb 01 '17 at 23:42