• Stars
    star
    19,889
  • Rank 1,282 (Top 0.03 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 10 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

RxJava bindings for Android

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

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'
}
  • RxAndroid:
  • RxJava:

Additional binaries and dependency information for can be found at search.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'
}

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.

More Repositories

1

RxJava

RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
Java
47,865
star
2

rxjs

A reactive programming library for JavaScript
TypeScript
30,686
star
3

RxSwift

Reactive Programming in Swift
Swift
24,267
star
4

RxKotlin

RxJava bindings for Kotlin
Kotlin
7,036
star
5

RxGo

Reactive Extensions for the Go language.
Go
4,921
star
6

RxPY

ReactiveX for Python
Python
4,775
star
7

rxdart

The Reactive Extensions for Dart
Dart
3,338
star
8

RxCpp

Reactive Extensions for C++
C++
3,008
star
9

RxPHP

Reactive extensions for PHP
PHP
1,685
star
10

learnrx

A series of interactive exercises for learning Microsoft's Reactive Extensions Library for Javascript.
JavaScript
1,403
star
11

RxNetty

Reactive Extension (Rx) Adaptor for Netty
Java
1,384
star
12

IxJS

The Interactive Extensions for JavaScript
TypeScript
1,297
star
13

RxRuby

Reactive Extensions for Ruby
Ruby
957
star
14

RxScala

RxScala – Reactive Extensions for Scala – a library for composing asynchronous and event-based programs using observable sequences
Scala
888
star
15

RxJavaFX

RxJava bindings for JavaFX
Java
520
star
16

RxRust

The Reactive Extensions for the Rust Programming Language
Rust
488
star
17

RxClojure

RxJava bindings for Clojure
Clojure
362
star
18

rxjs-tslint

TSLint rules targeting RxJS
TypeScript
309
star
19

RxJavaReactiveStreams

Adapter between RxJava and ReactiveStreams
Java
235
star
20

RxJavaDebug

Java
161
star
21

rxjs-docs

The home for new work on the new RxJS docs (RxJS v 5 and up). New to this space? Say hi here: https://github.com/ReactiveX/rxjs-docs/issues/24. Want to find out what's up? We're chatting here. https://github.com/ReactiveX/rxjs-docs/issues/4
TypeScript
160
star
22

RxGroovy

RxJava bindings for Groovy
Groovy
158
star
23

reactivex.github.io

ReactiveX Website
JavaScript
139
star
24

RxJavaAsyncUtil

Java
132
star
25

RxJavaString

Java
129
star
26

RxApacheHttp

RxJava bindings for Apache HTTP
Java
118
star
27

RxJavaJoins

Java
100
star
28

RxSwing

RxJava bindings for Swing
Java
98
star
29

RxJavaMath

Math operators for RxJava.
Java
96
star
30

rxjs-advent-2018

RxJS 2018 Advent Calendar
TypeScript
89
star
31

rxjs-core-notes

Notes from RxJS core meetings
77
star
32

RxJavaFileUtils

File utilities with RxJava
Java
62
star
33

RxJavaComputationExpressions

Java
60
star
34

RxJavaGuava

Java
54
star
35

RxJavaParallel

Experimental Parallel Extensions for RxJava
Java
54
star
36

RxJRuby

RxJava bindings for JRuby
Ruby
38
star
37

Rx.NET

Rx.NET – Reactive Extensions for .NET – a library for composing asynchronous and event-based programs using observable sequences for the CLR.
31
star
38

RxQuasar

RxJava bindings for Quasar
Java
16
star
39

RxRoboVM

RxJava bindings for iOS
Java
7
star
40

BuildInfrastructure

Test project for the new build system.
Groovy
5
star
41

RxSwing2

Reactive bindings for Java 8 Swing on top of RxJava 2
4
star