Room and ListenableFuture

Room also supports an AndroidX edition of Guava’s ListenableFuture interface. You can have DAO functions return a ListenableFuture instead of an RxJava Single, for example. ListenableFuture allows you to register a callback to find out when the work is completed.

This option is relatively obscure and has very little documentation. Unless you are integrating with some framework that itself is based on Future and ListenableFuture, the other reactive solutions presented in this chapter are substantially more popular.

Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.