10/10/2017, 11:33 AM
Our model classes and networking code (retrofit) is defined in a pure-Java library project which is a dependency of the Android project. I've added a new model as a kotlin data class - all seems good. But I now want to use it in the view layer (databinding FTW) and so make it parcelable to survive rotate. The pure-Java project can't see android.os.Parcelable. A data class can't be extended. I can lose some convenience by dropping 'data' so I can extend but as the properties are defined in the constructor the subclass needs to list all the properties again which is a lot of duplication adding a maintenance burden. Is there a pattern I should follow here please?


10/11/2017, 2:04 AM
Maybe not the best, but working solution - implement Serilizable instead of Parcelable. It’s not so fast but can be used in pure Java and in Android code