InvalidationTracker.Observer

public abstract class InvalidationTracker.Observer


An observer that can listen for changes in the database.

Summary

Public constructors

Observer(@NonNull String[] tables)

Protected constructors

Observer(@NonNull String firstTable, @NonNull String rest)

Observes the given list of tables and views.

Public methods

abstract void

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

Public constructors

Observer

Added in 2.0.0
public Observer(@NonNull String[] tables)

Protected constructors

Observer

Added in 2.0.0
protected Observer(@NonNull String firstTable, @NonNull String rest)

Observes the given list of tables and views.

Parameters
@NonNull String firstTable

The name of the table or view.

@NonNull String rest

More names of tables or views.

Public methods

onInvalidated

Added in 2.0.0
public abstract void onInvalidated(@NonNull Set<@NonNull String> tables)

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

Parameters
@NonNull Set<@NonNull String> tables

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.