RxAndroid


License

License

Categories

Categories

React User Interface Web Frameworks RxJava Container Microservices Reactive libraries
GroupId

GroupId

io.reactivex.rxjava2
ArtifactId

ArtifactId

rxandroid
Last Version

Last Version

2.1.1
Release Date

Release Date

Type

Type

aar
Description

Description

RxAndroid
RxAndroid
Project URL

Project URL

https://github.com/ReactiveX/RxAndroid
Source Code Management

Source Code Management

https://github.com/ReactiveX/RxAndroid

Download rxandroid

How to add to project

<!-- https://jarcasting.com/artifacts/io.reactivex.rxjava2/rxandroid/ -->
<dependency>
    <groupId>io.reactivex.rxjava2</groupId>
    <artifactId>rxandroid</artifactId>
    <version>2.1.1</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/io.reactivex.rxjava2/rxandroid/
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
// https://jarcasting.com/artifacts/io.reactivex.rxjava2/rxandroid/
implementation ("io.reactivex.rxjava2:rxandroid:2.1.1")
'io.reactivex.rxjava2:rxandroid:aar:2.1.1'
<dependency org="io.reactivex.rxjava2" name="rxandroid" rev="2.1.1">
  <artifact name="rxandroid" type="aar" />
</dependency>
@Grapes(
@Grab(group='io.reactivex.rxjava2', module='rxandroid', version='2.1.1')
)
libraryDependencies += "io.reactivex.rxjava2" % "rxandroid" % "2.1.1"
[io.reactivex.rxjava2/rxandroid "2.1.1"]

Dependencies

compile (1)

Group / Artifact Type Version
io.reactivex.rxjava2 : rxjava jar 2.2.6

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.robolectric : robolectric jar 3.8

Project Modules

There are no modules declared in this project.

RxAndroid: Reactive Extensions for Android

Android specific bindings for RxJava 3.

This module adds the minimum classes to RxJava that make writing reactive components in Android applications easy and hassle-free. More specifically, it provides a Scheduler that schedules on the main thread or any given Looper.

Communication

Since RxAndroid is part of the RxJava family the communication channels are similar:

Binaries

allprojects {
    repositories {
        maven { url "https://oss.jfrog.org/libs-snapshot" }
    }
}

dependencies {
    implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
    // 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.0.0'
}
  • RxAndroid:
  • RxJava:

Additional binaries and dependency information for can be found at search.maven.org.

Build

To build:

$ git clone [email protected]:ReactiveX/RxAndroid.git
$ cd RxAndroid/
$ ./gradlew build

Further details on building can be found on the RxJava Getting Started page of the wiki.

Sample usage

A sample project which provides runnable code examples that demonstrate uses of the classes in this project is available in the sample-app/ folder.

Observing on the main thread

One of the most common operations when dealing with asynchronous tasks on Android is to observe the task's result or outcome on the main thread. Using vanilla Android, this would typically be accomplished with an AsyncTask. With RxJava instead you would declare your Observable 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 the Observable on a new thread, and emit results through onNext on the main thread.

Observing on arbitrary loopers

The previous sample is merely a specialization of a more general concept: binding asynchronous communication to an Android message loop, or Looper. In order to observe an Observable on an arbitrary Looper, create an associated Scheduler by calling AndroidSchedulers.from:

Looper backgroundLooper = // ...
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 through onNext on whatever thread is running backgroundLooper.

Bugs and Feedback

For bugs, feature requests, and discussion please use GitHub Issues. For general usage questions please use the mailing list or StackOverflow.

LICENSE

Copyright 2015 The RxAndroid authors

Licensed 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.0

Unless required by applicable law or agreed to in writing, software
distributed 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 and
limitations under the License.
io.reactivex.rxjava2

ReactiveX

Reactive Extensions for Async Programming

Versions

Version
2.1.1
2.1.0
2.0.2
2.0.1
2.0.0
2.0.0-RC1