Posts

Exploring Android Navigation Architecture Component - MVVM - Kotlin

Image
Navigation Architecture Component is released as a part of JetPack and androidx package. Its aim is to simplify the implementation of Navigation in our Android App. It defines a set of principles to build an in-app navigation with consistent and predictable user experience. Its main concept is to use single-activity architecture. It also has support for both Activity and Fragment. Principle of Navigation: The following are the principles of Navigation. App should have fixed starting destination A stack is used to represent the navigation state of app The 'Up' button never exits the app Up and Back are equivalent within your app's task Deep linking to a destination or navigating to the same destination should yield the same stack You can find the detailed explanation, here . Components of Navigation: (i) Navigation Graph - It's nothing but a map/blueprint of our in-app navigation. It has a list of all fragments and activities. We can also

Exploring Databinding Library in Android - Kotlin

Image
Introduction: Data binding library is a support library, which allows us to bind data sources directly to UI components of layout file. Binding components this way, reduces boilerplate code in our business logic where we usually update UI when new data is available. It also improves app's performance and helps to prevent memory leak and NullPointerException. textView.text = user.name can be written simply in layout as follows, and no need to write in Activity class.                                                             <TextView                                                                   ...                                                                   android:text="@{user.name}" /> You can find the project in Github . Prerequisite: build.gradle First, we have enable dataBinding in app-level build.gradle                            android {                                     dataBinding {