public void writeToParcel(Parcel parcel, int flags) throws IOException {
doSomethingThatThrowsIOException();
}
Quoth the compiler:
Exception IOException is not compatible with throws clause in
Parcelable.writeToParcel(Parcel, int)
I don’t see a throws clause anywhere in the docs or the actual Parcelable code. Is this a pesky threading issue?
The “writeToParcel” method is overridden from the parent class: Parcel. When you override a method, you can’t change nor the signature nor the throws clause of the original method.
The two options are: externalize the stuff that throws IOException
OR Handle the exception inside a try – catch block…