Parcelable

You are discouraged to use the Java serialization framework on the Android platform for performance reasons. Instead, Android comes with its own serialization tool: Parcelable. A Parcelable class requires you to implement the Parcelable interface and also to fulfill a certain contract as show below.

A Parcelable class forces you to implement a lot of boilerplate code, but offers great performance as it does not rely on runtime reflection like the default Java serialization framework. But when it comes to Scala on Android there emerges another problem: the Parcelable contract requires a static class member. This is impossible in Scala because there is no support for statics.

Luckily, the Scala compiler checks for the AndroidParcelable interface and treats it in a special way to support Android development. At the end of the day there is just another contract to implement that relies on the class' companion to overcome the lack of statics. Below is a valid Scala implementation of the previous example.

Alternatives

Scala comes with first class macro support (compile time reflection). This allows for code generation at compile time that may help to reduce boilerplate in use cases like this without sacrificing performance. To simplify Inter Process Communication (IPC) with the Parcelable contract, you could instead try one of the numerous JavaScript Object Notation libraries, or Scala Pickling, a project that aims to bring boilerplate-free serialization to Scala.