- Notifications
You must be signed in to change notification settings - Fork0
RxJava bindings for Android
License
rbqren000/RxAndroid
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Android specific bindings forRxJava 3.
This module adds the minimum classes to RxJava that make writing reactive components in Androidapplications easy and hassle-free. More specifically, it provides aScheduler that schedules onthe main thread or any givenLooper.
Since RxAndroid is part of the RxJava family the communication channels are similar:
- Google Group:RxJava
- Twitter:@RxJava
- StackOverflow:rx-android
- GitHub Issues
dependencies { implementation'io.reactivex.rxjava3:rxandroid:3.0.2'// Because RxAndroid releases are few and far between, it is recommended you also// explicitly depend on RxJava's latest version for bug fixes and new features.// (see https://github.com/ReactiveX/RxJava/releases for latest 3.x.x version) implementation'io.reactivex.rxjava3:rxjava:3.1.5'}Additional binaries and dependency information for can be found atsearch.maven.org.
Snapshots of the development version are available in Sonatype's snapshots repository.
repositories { mavenCentral() maven { url'https://oss.sonatype.org/content/repositories/snapshots/' }}dependencies { implementation'io.reactivex.rxjava3:rxandroid:3.1.0-SNAPSHOT'}To build:
$ git clone git@github.com:ReactiveX/RxAndroid.git$cd RxAndroid/$ ./gradlew buildFurther details on building can be found on the RxJavaGetting Started page of the wiki.
A sample project which provides runnable code examples that demonstrate uses of the classes in thisproject is available in thesample-app/ folder.
One of the most common operations when dealing with asynchronous tasks on Android is to observe the task'sresult or outcome on the main thread. Using vanilla Android, this would typically be accomplished with anAsyncTask. With RxJava instead you would declare yourObservable to be observed on the main thread:
Observable.just("one","two","three","four","five") .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(/* an Observer */);
This will execute theObservable on a new thread, and emit results throughonNext on the main thread.
The previous sample is merely a specialization of a more general concept: binding asynchronouscommunication to an Android message loop, orLooper. In order to observe anObservable on an arbitraryLooper, create an associatedScheduler by callingAndroidSchedulers.from:
LooperbackgroundLooper =// ...Observable.just("one","two","three","four","five") .observeOn(AndroidSchedulers.from(backgroundLooper)) .subscribe(/* an Observer */)
This will execute the Observable on a new thread and emit results throughonNext on whatever thread isrunningbackgroundLooper.
For bugs, feature requests, and discussion please useGitHub Issues.For general usage questions please use themailing list orStackOverflow.
Copyright 2015 The RxAndroid authorsLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.About
RxJava bindings for Android
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Languages
- Java100.0%