Building a Reactive Functional Todo Application with Kotlin in Android (Part 1)
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
- Intro to Kotlin (Basic Types, Type Inference, Casting and Strings)
- Intro to Kotlin (Basic Operations and Collections)
- Intro to Kotlin (Control Flow and Conditionals)
- Intro to Kotlin (Functions in Kotlin)
- Intro to Kotlin (Advanced Functions)
- Intro to Kotlin (Classes, Visibility Modifiers, Objects)
- Intro to Kotlin (Nullables, Data Classes, Enum Classes and Sealed Classes)
- Intro to Kotlin (Interfaces, Inheritance, Type Alias and Abstract Classes)
Posted on Utopian.io - Rewarding Open Source Contributors
Being A SteemStem Member
Hey @tensor I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
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
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.