Building a responsive UI in Android has not always been easy considering the number of devices with different screen sizes, aspect ratio, resolution, etc. Complex layouts usually end up containing several nested view groups which significantly decreases performance. The impact of these problems can be diminished by converting your layouts to the flexible and flat in hierarchy ConstraintLayout which I’m going to introduce in this post.
In my last post, I’ve introduced the Android data binding support library which helps to get rid of unnecessary boiler-plate code related to view-model binding. In this post, I’d like to introduce you to the Android MVVM pattern (Model-View-ViewModel) which builds upon data binding functionality and helps to keep the architecture design of your applications clean and its parts clearly decoupled.
Every Android developer knows the usual tiresome way of binding their application logic with layouts. Tens or even hundreds of boilerplate code lines containing the findViewById methods and never-ending manual updating of view properties based on changes in data. Thankfully, Android data binding support library comes to help automate things and simplify your code.