Can anyone tell me what are the use cases for RxJava
in Android
?
I have gone through a couple of tutorials they all provide explanations about how it works but nobody has provided what are use cases of RxJava in Android.
So Where & in which components can I use RxJava in Android ?
Can anyone tell me what are the use cases for RxJava in Android?
First and foremost, many places where you have a background thread in Android, you can use RxJava to replace the thread (or AsyncTask
or whatever). This includes:
ContentResolver
requests of content and document providersSecondarily, you may be able to manage other incoming sources of data as event streams via RxJava, such as input events (see RxBinding).
in which components can I use RxJava in Android ?
Few ContentProvider
implementations will use RxJava, as they expose a synchronous API. Few BroadcastReceiver
instances will live long enough for RxJava to be useful. So, mostly, RxJava will be in support of activities and services, though the actual RxJava code may reside in other classes used by activities and services (e.g., view-models, presenters, repositories).