Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 2.0.0
belongs to Maven artifact androidx.room:room-rxjava2:2.0.0-rc01

RxRoom

public class RxRoom
extends Object

java.lang.Object
   ↳ androidx.room.RxRoom


Helper class to add RxJava2 support to Room.

Summary

Fields

public static final Object NOTHING

Data dispatched by the publisher created by createFlowable(RoomDatabase, String).

Public constructors

RxRoom()

This constructor was deprecated in API level 2.0.0. This type should not be instantiated as it contains only static methods.

Public methods

static Flowable<Object> createFlowable(RoomDatabase database, String... tableNames)

Creates a Flowable that emits at least once and also re-emits whenever one of the observed tables is updated.

static Observable<Object> createObservable(RoomDatabase database, String... tableNames)

Creates a Observable that emits at least once and also re-emits whenever one of the observed tables is updated.

Inherited methods

Fields

NOTHING

added in version 2.0.0
public static final Object NOTHING

Data dispatched by the publisher created by createFlowable(RoomDatabase, String).

Public constructors

RxRoom

added in version 2.0.0
public RxRoom ()

This constructor was deprecated in API level 2.0.0.
This type should not be instantiated as it contains only static methods.

Public methods

createFlowable

added in version 2.0.0
public static Flowable<Object> createFlowable (RoomDatabase database, 
                String... tableNames)

Creates a Flowable that emits at least once and also re-emits whenever one of the observed tables is updated.

You can easily chain a database operation to downstream of this Flowable to ensure that it re-runs when database is modified.

Since database invalidation is batched, multiple changes in the database may results in just 1 emission.

Parameters
database RoomDatabase: The database instance

tableNames String: The list of table names that should be observed

Returns
Flowable<Object> A Flowable which emits NOTHING when one of the observed tables is modified (also once when the invalidation tracker connection is established).

createObservable

added in version 2.0.0
public static Observable<Object> createObservable (RoomDatabase database, 
                String... tableNames)

Creates a Observable that emits at least once and also re-emits whenever one of the observed tables is updated.

You can easily chain a database operation to downstream of this Observable to ensure that it re-runs when database is modified.

Since database invalidation is batched, multiple changes in the database may results in just 1 emission.

Parameters
database RoomDatabase: The database instance

tableNames String: The list of table names that should be observed

Returns
Observable<Object> A Observable which emits NOTHING when one of the observed tables is modified (also once when the invalidation tracker connection is established).