Sign in

Matt Dolan has been eating doughnuts and developing with Android since the dark days of v1.6.
Photo by Sven Mieke on Unsplash

Material Design has always specified that top app bars can be positioned at the same elevation as content until that content scrolls, with Material Components for Android providing the app:liftOnScroll attribute.


Photo by Todd Kent on Unsplash

The auto-import functionality of Android Studio is often cluttered, presenting the user with imports for deprecated classes. For example, even though junit.framework.Assert is deprecated, the IDE still provides it as a choice when auto-importing and auto-completing on assertEquals:


Photo by Jeremy Thomas on Unsplash

When I think about MVI, the process boils down to three key concepts:

  • A unidirectional cycle of data — i.e. data flows in one direction
  • Processing of intents is non-blocking
  • The state is immutable — outside of the Model (typically a ViewModel on Android)

Conceptually MVI is not complicated, so why use a framework when you can write your own? Watch How to write your own MVI system and why you shouldn’t, which demonstrates how to write a framework in less than 30 lines of code.

Writing an MVI style framework is not as simple as it seems:

  • there…


Image by Dan Nelson from Pixabay

When updating my Android caching library, layercache, with built-in support for the new Jetpack SecurityEncryptedSharedPreferences I started to write unit tests using Robolectric, but soon came across the exception java.security.KeyStoreException: AndroidKeyStore not found.

Usually, shadows come to mind when faced with issues like this, but in this article, we will discuss why this won’t work and how we can get around the problem to continue to write unit tests without requiring a test device.

What is Jetpack Security

The Security library implements crypto security best practices for storing data at rest and currently provides the classes EncryptedSharedPreferences and EncryptedFile.

EncryptedSharedPreferences

EncryptedSharedPreferences is an implementation of…


It’s hard to write an app in Android without coming across the need to serialise data using either Parcelable or Serializable. In this article, we will explore why at Babylon Health we test our implementations of these interfaces even when using code-generation tools like @Parcelize, and the tools we use to help us write tests that work for all our classes.

Why test Parcelable and Serializable implementations

Our codebase contains over 50 Parcelable and Serializable objects. When I started at Babylon, most of these were implemented using AutoParcel; however, due to build performance issues using annotation processors, I re-wrote most of these by hand.

It is…


This 3-part mini-series talks a little bit about the technical choices I make when building an app, specifically an A-Z app, to go at least some of the way to describe some aspects of what makes a (technically) great app.

  1. UI
  2. Code quality
  3. Architecture

Architecture

It doesn’t matter whether you use MVP, MVVM, MVI or whatever the next craze is as long as you use it consistently in your project as there’s nothing worse than a code base with unclear intentions.

For this particular app, I use MVVM and LiveData with a sprinkling of coroutines and clean architecture, most importantly though…


To protect our apps from man-in-the-middle attacks one of the first things that usually springs to mind is certificate pinning. Indeed, in early 2017 I published an article that discusses implementing SSL Pinning on Android.

At the time little did I know that in late 2017 Google were to announce that Chrome 68 would deprecate support for HTTP public key pinning (HPKP). Chrome 68 was released on 24 July 2018.

The issues of certificate pinning are numerous. Firstly deciding on a reliable set of keys to pin against is tough. Once you made that decision if your expectations don’t match…


This 3-part mini-series talks a little bit about the technical choices I make when building an app, specifically an A-Z app, to go at least some of the way to describe some aspects of what makes a (technically) great app.

  1. UI
  2. Code quality
  3. Architecture

Code quality

The quality of the code is more than just how you go about structuring your classes but extends into how you spot potential issues from null pointer exceptions to memory leaks.

Static analysis

There are some excellent static analysis tools out there such as Facebook’s Infer and Uber’s NullAway if your code base is still heavily Java, however…


This 3-part mini-series talks a little bit about the technical choices I make when building an app, specifically an A-Z app, to go at least some of the way to describe some aspects of what makes a (technically) great app.

  1. UI
  2. Code quality
  3. Architecture

In mid-2017 my daughter was born, and I instantly knew I wanted to create a mobile app to help her learn.


In the incredible Effective Java, item 30 continues from the previous item covering generic methods in preference to a client needing explicit casts on input parameters and return values.

The implementation in Kotlin is not much different to Java just with the type parameter list specified between fun and the function name.

// Generic method
fun <T> union(vararg sets: Set<T>): Set<T> {
return sets.flatMap { it }.toSet()
}
val union = union<Number>(setOf<Int>(1, 2), setOf<Double>(3.1, 4.2))

Introducing generic methods shouldn’t break backwards compatibility in Kotlin unless of course it introduces a new generic class as discussed in item 29 so there…

Matthew Dolan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store