Observer

abstract class Observer
kotlin.Any
   ↳ androidx.room.InvalidationTracker.Observer

An observer that can listen for changes in the database.

Summary

Public constructors
<init>(@NonNull tables: Array<String!>)

Observes the given list of tables and views.

Protected constructors
<init>(@NonNull firstTable: String, vararg rest: String!)

Observes the given list of tables and views.

Public methods
abstract Unit
onInvalidated(@NonNull tables: MutableSet<String!>)

Called when one of the observed tables is invalidated in the database.

Public constructors

<init>

Observer(@NonNull tables: Array<String!>)

Observes the given list of tables and views.

Parameters
tables Array<String!>: The list of tables or views to observe for changes.

Protected constructors

<init>

protected Observer(@NonNull firstTable: String, vararg rest: String!)

Observes the given list of tables and views.

Parameters
firstTable String: The name of the table or view.
rest String: More names of tables or views.

Public methods

onInvalidated

abstract fun onInvalidated(@NonNull tables: MutableSet<String!>): Unit

Called when one of the observed tables is invalidated in the database.

Parameters
tables MutableSet<String!>: A set of invalidated tables. This is useful when the observer targets multiple tables and you want to know which table is invalidated. This will be names of underlying tables when you are observing views.