I am using UsbSerialForAndroid library for implementing a serial port connection to a device.
I need to send a serial port object across activities. The definition for the UsbSerialPort is here.
At the moment, my code is able to return a string specifying port address with the help of putExtra method of Intent. I wish to send the serial port to the other activity (this is because I am not able to recreate the serial port object from address).
In order to send an object along with an Intent the object should be parcelable. But the original library class file is in java.
How to implement parcelable on such a pre-existing java class? I prefer to use kotlin language to achieve this.
EDIT
One option that seems logical is to use the original SerialUsbPort class as a base class and extent the new class to parcelable (with @Parselize annotation) and then cast the old object into new (is that even right?).