If you haven’t heard of Realm before, it’s a mobile database technology for Android (iOS too). Opposed to SQLite, it allows you to work with data objects directly at the persistence layer. On top of that, there is a powerful functional-style query API and effort has been made to make it even faster than traditional SQLite operations. It was for these reasons I decided to give Realm a try.
When I first used Realm around a year ago, my initial impressions were quite good. I needed to persist some user data locally on the phone, but it was a bit too complex for SharedPreferences. Realm allowed me to quickly and cleanly write the necessary code to do this. There was no need to write any of the extra cruft that would have been required with SQLite.
Since the early days of Android, there has been an ongoing debate about whether or not enums should be used due to their overhead in memory consumption. Google has long been in favor of using int constants as a substitute and even go as far as saying enums should be strictly avoided. A memory comparison between the two methods is neatly outlined in this Stack Overflow answer.
Recently, this debate has come back into the spotlight. One reason for this is that Google has been pushing the issue lately as part of their #perfmatters campaign, which educates Android developers on performance related topics. They’ve also released a new support annotations library containing the @IntDef annotation, which provides compile-time type checking for int constants (I wrote an article on it here). As a result of all of this, there has been backlash from some prominent community members regarding the merit of Google’s stance on enums.
At some point you may find yourself needing to implement a splash screen for your Android app. Reasons for doing so include matching an existing design for iOS, performing necessary background work at start up, or simply for the visual appeal alone. It should be noted that splash screens are certainly not required in your app. In fact, some feel that they should be avoided entirely. Still, it is not uncommon to come across Android apps that utilize a splash screen.
This article provides a detailed outline for implementing a splash screen on Android. While the implementation is relatively straight forward, there are a few details that often get overlooked. We’ve also provided a working sample project that can be run on your device or emulator.