`Day19` - Halfway through Lesson5 ◦ Applicatio...
# 100daysofkotlin-2021
j
Day19
• Halfway through Lesson5 ◦ Application architecture, Separation of Concerns design principle ▪︎ Limitation of using onSavedInstanceState - 1) require extra code to store the state in the bundle & the logic to retrieve the state 2) size of bundle is limited ▪︎ (Simplified) MVVMUI Controller (activity/fragment) - Display views. Handle OS event(ex. capture user keyboard input). Notify View Model that OS event has happened • View Model - Abstract class that holds and prepares data needed for the UI. Contain instance of LiveData. Survives configuration changes. No(less?) size restriction. Should not contain references to activity/fragment/view • Live Data - observable data holder class that is lifecycle-aware ◦ Observer pattern - Observers “watch” the subject. When event causes subject’s status change, subject notifies observers. (In this case, Live Data is the subject and UI controllers are the observers.) ▪︎ Benefits • Organized, Easier to debug, Fewer lifecycle issues, Modular • Faster and easier testing (since ViewModel contains no references to activities, fragments, or views) ◦ (androidTest - heavy. require emulating android framework, test - doesn’t require emulating)
Self-Comment
• It is quite hard to concentrate after the pass-day 🤔 Hope I can concentrate on something at certain time whenever I want to. That is the superpower I really want.. Felt quite depressed that I wasn’t that productive enough today, but anyways it’s better doing than not doing so.
Goals Tomorrow
• Finish lesson 5 • BLE research (googling time)
🔥 1
b
A few easy links you might find useful. I'm sure you'll come across them with a quick search as well. 😅 • Android Docs: Bluetooth Overview • Android Developers YouTube Video:

DevBytes: Bluetooth Low Energy API in Android 4.3

• Medium Article: _How To Use Android BLE to Communicate with Bluetooth Devices - An Overview & Code examples_
android eyes 1
🥺 1
👀 1
j
Thanks for nice suggestionssssss!