Building a Reactive Functional Todo Application with Kotlin in Android (Part 1)

in #utopian-io7 years ago (edited)

What Will I Learn?

  • You will learn how to use the LiveData android component library in Kotlin
  • You will learn how to build a Kotlin Android Application using a reactive functional paradigm
  • You will learn how to use Observables and Stores to access a data layer in an Android application

Requirements

  • Android Studio 3.0 or Android Studio Canary
  • A basic understanding of the Android ecosystem
  • A fair understanding of Kotlin or the Java programming language

Difficulty

  • Intermediate

Description

In this video tutorial, we start building out a Todo application using Kotlin an Android. We make use of the Android life cycle component libraries, specifically, ViewModel and LiveData. Both of these libraries allow us to take advantage of the **android life-cycle **to abstract our data in a functional reactive manner. In this part of the tutorial, we are mainly dealing with the LiveData Library.

The LiveData library allows us to implement the Observer Pattern for the Data Holders in our application. LiveData allows us to add a LifeCycleOwner as an observer to our data updates. Every time our data is updated in some way, it will automatically proliferate the changes through all of the dependent classes and data structures. Our Observers are bound so that the data will only be emitted to these Observers in specific cases. This dramatically decreases memory leaks and NullPointerExceptions.

We build out our data classes for our Todo and TodoModel respectively. These classes model the shape of the data that the user is passing into our application. We then create abstract and sealed classes to simulate the various actions that a user can make in our program. We then extend this data layer by adding in a store layer. This layer lets us deal with the data and actions in a purely functional and reactive manner. When an activity commits an action to our store, it calls a function which is mapped onto our data. This then returns a subset of our data based on the function call.

The source code for this project can be found here

Video Tutorial

Related Content

  • Android Applications in Kotlin
  • Desktop Applications in Kotlin
  • Intro to Kotlin Series



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Hey @tensor I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Thank you for providing a platform for people like me.

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thank you for your hard work as always.

nteresting, very helpful information that likes technology and information

Congratulations @tensor! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Nice post.I respect you very much because you contribute to steemit.I will do activities like you.I would like to extend the steemit.

Everyone can see that you are spamming people's posts and that you are a bot. Please go away.

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 62014.91
ETH 2410.27
USDT 1.00
SBD 2.50