July 2018
Intermediate to advanced
242 pages
8h 6m
English
We have started by defining the User class, which contains a property of the Address class. Both User and Address are decorated with the @Parcelize annotation. It tells the Android Extensions plugin to generate code for the Parcelable interface implementation. Inside the testUserParcelisation() function, we are creating an instance of the User class and serializing it using the Android Bundle mechanism. We are putting the original User class instance to the Bundle under the "my_user" key, and later we deserialize its instance by calling bundle.get("my_user") as User. Finally, we compare the original and deserialized User instances using the assertEquals() function.
Read now
Unlock full access