- I'm using an external library for 3rd party map retrieving in Android.
- There's a class that I want to pass through Intent, so I want to make it implement
Parcelable
. - But the class is from the external library.
What's the best practice to do in this case?
What I did was:
- Create a custom class that extends this class(let me call it
A
) and implement Parcelable - But when I get all these
A
class instances from the library's network request, I found out that I can't cast it to my custom class object since it's casting from parent class to child class. - So I added a static method that can copy member variables from
A
class to newly instantiated custom object's member variables, which literally converts external library classA
into my custom class. - It does work, but it looks like a code smell. How can I improve this? Or is it not a code smell?