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.
When it comes to persisting data on Android, the officially recommended way is to use the SQLite database. Even though the Android framework provides some kind of support in form of the helper classes, the developer still has to struggle with writing raw SQL queries and manually transforming objects to records in the database. This is where Android ORM database libraries come to give a helping hand.
In the previous post, lambda expressions in Java 8 have been introduced. In this post I will describe how to enable and use Java 8 language features including lambda expressions in Android development.
Until recently, only Java 7 was officially supported when developing for Android. However, this changes with the release of Android N (Nougat, API version 24) and its official support for Java 8. Before Android N was released however, it was also possible to use an external library called retrolambda which allows to bring lambda expressions support to Java 7 and lower.
Java 8 brought many new features known up until now mainly from functional programming languages. Among the most interesting ones, there are lambda expressions, default methods, stream API, etc. In this post, let me introduce you to the first of listed — lambda expressions.