Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Spring for Android Application Development

You're reading from   Learn Spring for Android Application Development Build robust Android applications with Kotlin 1.3 and Spring 5

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher Packt
ISBN-13 9781789349252
Length 392 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
S. M. Mohi Us Sunnat S. M. Mohi Us Sunnat
Author Profile Icon S. M. Mohi Us Sunnat
S. M. Mohi Us Sunnat
Igor Kucherenko Igor Kucherenko
Author Profile Icon Igor Kucherenko
Igor Kucherenko
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. About the Environment 2. Overview of Kotlin FREE CHAPTER 3. Overview of Spring Framework 4. Spring Modules for Android 5. Securing Applications with Spring Security 6. Accessing the Database 7. Concurrency 8. Reactive Programming 9. Creating an Application 10. Testing an Application 11. Assessments 12. Other Books You May Enjoy

Blocking and non-blocking

When we work with Android, we should remember that we have a main thread that is responsible for a user interface. First, it is not a good idea to invoke long-term operations in the main thread, because in that case, a user interface freezes. Secondly, when we invoke a synchronous method, this blocks a thread. Our user interface is unresponsive until a function that is invoked from the main thread returns the result. That is why we should invoke a long-term operation asynchronously, and reactive programming can help us to do just that.

The Mono and Flux classes contain the publishOn and subscribeOn methods that can switch threads when operators are invoked. The subscribeOn method is used to specify a scheduler that produces emitted values, and the publishOn is used to specify a thread scheduler for the downstream of an observable.

Scheduler is an abstraction...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime