Book Image

Reactive Android Programming

By : Tadas Subonis
Book Image

Reactive Android Programming

By: Tadas Subonis

Overview of this book

<p>Writing code on Android is hard. Writing a high quality code that involves concurrent and parallel tasks is even harder. Ensuring that this code will run without unforeseen race conditions is an the order of magnitude harder. RxJava is the tool that can help write code for such tasks.</p> <p>In this book a novice developer will be introduced to a wide variety of tools that RxJava provides to enable them to produce robust and high-quality code for their asynchronous tasks by building a relatively simple(and high quality) application using advanced RxJava techniques to produce a high quality product.</p> <p>Part 1 of the book will lead the developer through RxJava's initial setup in Android environment. In Part 2, the reader will learn RxJava 2.0 step-by-step by starting off with stock data processing and display.The developer will learn to choose appropriate Schedulers and to use Retrofit library for remote requests.In Part 3, the reader will also learn advanced topics such as adding integration to Twitter to process its streaming data by combining it with stock data.</p>
Table of Contents (19 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
1
Building your First “Hello World” RxJava Application

Chapter 1. Building your First “Hello World” RxJava Application

Mastering Reactive Android programming with RxJava is no easy feat. At first, the way the code is structured and written may seem strange and alien. However, with some practice, we will quickly see that it is an easy and understandable way to write concurrent and parallel code.

One of the best ways to learn is by example. That's why we will build a simple application to learn RxJava. It will be a very straightforward financial stock quote monitoring app. We will tap into the streams of Yahoo Finance data to display the quotes while using the basics of RxJava.

In the later stages, we will plug in an endless stream of Twitter data and we will start using more advanced techniques to transform and handle data.First of all, we will start with a simple Hello World application that will provide a solid foundation to the all the things that we will learn.By the end of this chapter, we will learn and do the following things:

  • Create an initial barebone for the application
  • Set up RxJava and UI dependencies
  • Create an initial UI where we will show the stock quote updates
  • Initialize UI with mock data using RxJava to get a Hello World screen