Preview! Heads up: most things covered in this post are in a preview state of some sort. If you want the full technical details on this topic, you can jump to KEEP-226 and its design proposal instead of reading this article. JDK15 introduced a version of sealed classes and interfaces (see JEP 360) in a […]
Like before, this will be a mostly personal ramble about things that happened during the year. You’ve been warned. For the usual technical content, please tune in next year. The elephant in the room Let’s just get this out of the way: this year has been absolute rubbish. There’s no going around or sugar coating […]
This article is also available as a talk, check out the slides and recordings here. Introduction While the focus of this article is libraries, everything here applies to any project that has multiple modules. Each of those modules presents a public API to the outside world, exactly the same way a library does. When designing […]
One of the most significant items of the Effective Java book is Item 18: Favor composition over inheritance. To oversimplify its contents: Inheritance is a popular way to reuse code, by extending a class that has the functionality you need. However, it’s also very error prone. It violates encapsulation, because the subclass depends on the […]
SharedPreferences is a handy tool for saving small amounts of data in key-value pairs. However, accessing its API directly isn’t as practical as it could be. Krate is a wrapper library built on delegated properties, and it makes storing values in SharedPreferences simple and convenient. You can read about the API design of the library […]
2020-06-29 • Márton Braun This is a project over two years in the making, and I’m happy to finally announce it to a broader audience. It’s been quite the journey. The project started as the architecture for a single app back in mid-2018, and was then extracted into a library and spread internally to other […]
Fragments have… Complicated lifecycles, to say the least. Let’s take a look at these, and how they all fit into the world of Jetpack today. The instance lifecycle We’ll start from the middle, with the lifecycle of the Fragment class instance itself. I’ll, creatively, refer to this as the instance lifecycle. This lifecycle technically begins […]
In the previous article of this series, we discussed publishing a ViewState from the ViewModel, which is then observed by the View implementation, rendering content on the screen. However, not everything that the ViewModel has to notify the View about can go in the ViewState. Why? Because the ViewState is a somewhat permanent, sticky kind […]
One of the frequent challenges on Android is keeping the UI of the application in a consistent, sensible state. We see failures of this every day: applications get stuck with weird, glitched out UI. These are the kind of issues that “should never happen”. The root of the problem is state. The widget tree we […]